| @@ -12,7 +12,8 @@ class GoodsInfoAdmin(admin.ModelAdmin): | ||
| 12 | 12 |  | 
| 13 | 13 |  | 
| 14 | 14 | class RightInfoAdmin(admin.ModelAdmin): | 
| 15 | -    list_display = ('right_id', 'icon', 'title', 'subtitle', 'detail', 'minlevel', 'position', 'status', 'created_at', 'updated_at') | |
| 15 | +    list_display = ('right_id', 'right_type', 'icon', 'title', 'subtitle', 'detail', 'minlevel', 'position', 'status', 'created_at', 'updated_at') | |
| 16 | +    list_filter = ('right_type', 'status') | |
| 16 | 17 |  | 
| 17 | 18 |  | 
| 18 | 19 | class ShotTypeInfoAdmin(admin.ModelAdmin): | 
| @@ -0,0 +1,28 @@ | ||
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +# Generated by Django 1.11.26 on 2019-11-19 06:28 | |
| 3 | +from __future__ import unicode_literals | |
| 4 | + | |
| 5 | +from django.db import migrations, models | |
| 6 | + | |
| 7 | + | |
| 8 | +class Migration(migrations.Migration): | |
| 9 | + | |
| 10 | + dependencies = [ | |
| 11 | +        ('member', '0001_initial'), | |
| 12 | + ] | |
| 13 | + | |
| 14 | + operations = [ | |
| 15 | + migrations.AlterModelOptions( | |
| 16 | + name='goodsinfo', | |
| 17 | +            options={'verbose_name': '\u4f1a\u5458\u5546\u54c1\u4fe1\u606f', 'verbose_name_plural': '\u4f1a\u5458\u5546\u54c1\u4fe1\u606f'}, | |
| 18 | + ), | |
| 19 | + migrations.AlterModelOptions( | |
| 20 | + name='rightinfo', | |
| 21 | +            options={'verbose_name': '\u4f1a\u5458\u6743\u76ca\u4fe1\u606f', 'verbose_name_plural': '\u4f1a\u5458\u6743\u76ca\u4fe1\u606f'}, | |
| 22 | + ), | |
| 23 | + migrations.AddField( | |
| 24 | + model_name='rightinfo', | |
| 25 | + name='right_type', | |
| 26 | + field=models.IntegerField(choices=[(0, '\u5b9e\u7269'), (1, '\u865a\u62df'), (2, '\u4f18\u60e0\u5238')], db_index=True, default=1, help_text='\u6743\u76ca\u7c7b\u578b', verbose_name='right_type'), | |
| 27 | + ), | |
| 28 | + ] | 
| @@ -76,7 +76,18 @@ class GoodsInfo(BaseModelMixin): | ||
| 76 | 76 |  | 
| 77 | 77 |  | 
| 78 | 78 | class RightInfo(BaseModelMixin): | 
| 79 | + PHYSICAL = 0 | |
| 80 | + VIRTUAL = 1 | |
| 81 | + COUPON = 2 | |
| 82 | + | |
| 83 | + RIGHT_TYPE_TUPLE = ( | |
| 84 | + (PHYSICAL, u'实物'), | |
| 85 | + (VIRTUAL, u'虚拟'), | |
| 86 | + (COUPON, u'优惠券'), | |
| 87 | + ) | |
| 88 | + | |
| 79 | 89 | right_id = ShortUUIDField(_(u'right_id'), max_length=32, blank=True, null=True, help_text=u'权益唯一标识', db_index=True, unique=True) | 
| 90 | + right_type = models.IntegerField(_(u'right_type'), choices=RIGHT_TYPE_TUPLE, default=VIRTUAL, help_text=u'权益类型', db_index=True) | |
| 80 | 91 |  | 
| 81 | 92 | icon = models.ImageField(_(u'icon'), upload_to=upload_path, blank=True, null=True, help_text=u'权益图标') | 
| 82 | 93 | title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'权益名称') | 
| @@ -106,6 +117,7 @@ class RightInfo(BaseModelMixin): | ||
| 106 | 117 | def data(self): | 
| 107 | 118 |          return { | 
| 108 | 119 | 'right_id': self.right_id, | 
| 120 | + 'right_type': self.right_type, | |
| 109 | 121 | 'icon': self.icon_url, | 
| 110 | 122 | 'title': self.title, | 
| 111 | 123 | 'subtitle': self.subtitle, |