@@ -30,6 +30,7 @@ def pack_detail(request): |
||
| 30 | 30 |
|
| 31 | 31 |
return response(data={
|
| 32 | 32 |
'kol': kol.data, |
| 33 |
+ 'pack': pack.data, |
|
| 33 | 34 |
'goods': goods, |
| 34 | 35 |
'sales': sales, |
| 35 | 36 |
}) |
@@ -0,0 +1,23 @@ |
||
| 1 |
+# Generated by Django 2.2.12 on 2020-04-22 03:05 |
|
| 2 |
+ |
|
| 3 |
+from django.db import migrations, models |
|
| 4 |
+ |
|
| 5 |
+ |
|
| 6 |
+class Migration(migrations.Migration): |
|
| 7 |
+ |
|
| 8 |
+ dependencies = [ |
|
| 9 |
+ ('goods', '0001_initial'),
|
|
| 10 |
+ ] |
|
| 11 |
+ |
|
| 12 |
+ operations = [ |
|
| 13 |
+ migrations.AddField( |
|
| 14 |
+ model_name='packinfo', |
|
| 15 |
+ name='expired_at', |
|
| 16 |
+ field=models.DateTimeField(blank=True, help_text='创建时间', null=True, verbose_name='created_at'), |
|
| 17 |
+ ), |
|
| 18 |
+ migrations.AddField( |
|
| 19 |
+ model_name='packinfo', |
|
| 20 |
+ name='title', |
|
| 21 |
+ field=models.CharField(blank=True, db_index=True, help_text='标题', max_length=32, null=True, verbose_name='title'), |
|
| 22 |
+ ), |
|
| 23 |
+ ] |
@@ -0,0 +1,18 @@ |
||
| 1 |
+# Generated by Django 2.2.12 on 2020-04-22 03:10 |
|
| 2 |
+ |
|
| 3 |
+from django.db import migrations, models |
|
| 4 |
+ |
|
| 5 |
+ |
|
| 6 |
+class Migration(migrations.Migration): |
|
| 7 |
+ |
|
| 8 |
+ dependencies = [ |
|
| 9 |
+ ('goods', '0002_auto_20200422_1105'),
|
|
| 10 |
+ ] |
|
| 11 |
+ |
|
| 12 |
+ operations = [ |
|
| 13 |
+ migrations.AlterField( |
|
| 14 |
+ model_name='packinfo', |
|
| 15 |
+ name='expired_at', |
|
| 16 |
+ field=models.DateTimeField(blank=True, help_text='创建时间', null=True, verbose_name='expired_at'), |
|
| 17 |
+ ), |
|
| 18 |
+ ] |
@@ -46,6 +46,8 @@ class GoodsInfo(BaseModelMixin): |
||
| 46 | 46 |
|
| 47 | 47 |
class PackInfo(BaseModelMixin): |
| 48 | 48 |
pack_id = ShortUUIDField(_('pack_id'), max_length=32, blank=True, null=True, help_text='包唯一标识', db_index=True, unique=True)
|
| 49 |
+ title = models.CharField(_('title'), max_length=32, blank=True, null=True, help_text='标题', db_index=True)
|
|
| 50 |
+ expired_at = models.DateTimeField(_(u'expired_at'), blank=True, null=True, help_text=_(u'过期时间')) |
|
| 49 | 51 |
kol_id = models.CharField(_('kol_id'), max_length=32, blank=True, null=True, help_text='KOL 唯一标识', db_index=True)
|
| 50 | 52 |
|
| 51 | 53 |
class Meta: |
@@ -55,6 +57,12 @@ class PackInfo(BaseModelMixin): |
||
| 55 | 57 |
def __unicode__(self): |
| 56 | 58 |
return self.pk |
| 57 | 59 |
|
| 60 |
+ @property |
|
| 61 |
+ def data(self): |
|
| 62 |
+ return {
|
|
| 63 |
+ 'title': self.title, |
|
| 64 |
+ 'expired_at': tc.local_string(self.expired_at, format='%Y-%m-%d %H:%M'), |
|
| 65 |
+ } |
|
| 58 | 66 |
|
| 59 | 67 |
class PackGoodsInfo(BaseModelMixin): |
| 60 | 68 |
pack_id = models.CharField(_('pack_id'), max_length=32, blank=True, null=True, help_text='包唯一标识', db_index=True)
|