+ field=models.CharField(null=True, max_length=255, blank=True, help_text='\u578b\u53f7\u540d\u79f0', unique=True, verbose_name='model_name'),
+ ),
+ ]
@@ -0,0 +1,24 @@ |
||
| 1 |
+# -*- coding: utf-8 -*- |
|
| 2 |
+from __future__ import unicode_literals |
|
| 3 |
+ |
|
| 4 |
+from django.db import models, migrations |
|
| 5 |
+ |
|
| 6 |
+ |
|
| 7 |
+class Migration(migrations.Migration): |
|
| 8 |
+ |
|
| 9 |
+ dependencies = [ |
|
| 10 |
+ ('product', '0003_auto_20170630_0220'),
|
|
| 11 |
+ ] |
|
| 12 |
+ |
|
| 13 |
+ operations = [ |
|
| 14 |
+ migrations.AlterField( |
|
| 15 |
+ model_name='productcodesubmitloginfo', |
|
| 16 |
+ name='mount', |
|
| 17 |
+ field=models.CharField(max_length=255, blank=True, help_text='\u5361\u53e3', null=True, verbose_name='mount', db_index=True), |
|
| 18 |
+ ), |
|
| 19 |
+ migrations.AlterField( |
|
| 20 |
+ model_name='productinfo', |
|
| 21 |
+ name='mount', |
|
| 22 |
+ field=models.CharField(max_length=255, blank=True, help_text='\u5361\u53e3', null=True, verbose_name='mount', db_index=True), |
|
| 23 |
+ ), |
|
| 24 |
+ ] |
@@ -4,13 +4,14 @@ from django.db import models |
||
| 4 | 4 |
from django.utils.translation import ugettext_lazy as _ |
| 5 | 5 |
from shortuuidfield import ShortUUIDField |
| 6 | 6 |
|
| 7 |
-from tamron.basemodels import CreateUpdateMixin |
|
| 7 |
+from tamron.basemodels import CreateUpdateMixin, SexChoicesMixin |
|
| 8 | 8 |
|
| 9 | 9 |
|
| 10 | 10 |
class ProductModelInfo(CreateUpdateMixin): |
| 11 | 11 |
model_id = ShortUUIDField(_(u'model_id'), max_length=255, help_text=u'型号唯一标识', db_index=True, unique=True) |
| 12 |
- model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称') |
|
| 12 |
+ model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称', unique=True) |
|
| 13 | 13 |
integral = models.IntegerField(_(u'integral'), default=0, help_text=u'型号积分') |
| 14 |
+ has_mount = models.BooleanField(_(u'has_mount'), default=True, help_text=u'是否有卡口', db_index=True) |
|
| 14 | 15 |
|
| 15 | 16 |
class Meta: |
| 16 | 17 |
verbose_name = _(u'产品型号信息') |
@@ -25,21 +26,15 @@ class ProductModelInfo(CreateUpdateMixin): |
||
| 25 | 26 |
'model_id': self.model_id, |
| 26 | 27 |
'model_name': self.model_name, |
| 27 | 28 |
'integral': self.integral, |
| 29 |
+ 'has_mount': self.has_mount, |
|
| 28 | 30 |
} |
| 29 | 31 |
|
| 30 | 32 |
|
| 31 |
-class ProductInfo(CreateUpdateMixin): |
|
| 32 |
- MALE = 1 |
|
| 33 |
- FEMALE = 0 |
|
| 34 |
- |
|
| 35 |
- SEX_TYPE = ( |
|
| 36 |
- (MALE, u'男'), |
|
| 37 |
- (FEMALE, u'女'), |
|
| 38 |
- ) |
|
| 39 |
- |
|
| 33 |
+class ProductInfo(CreateUpdateMixin, SexChoicesMixin): |
|
| 40 | 34 |
model_id = models.CharField(_(u'model_id'), max_length=255, blank=True, null=True, help_text=u'型号唯一标识', db_index=True) |
| 41 | 35 |
model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称', db_index=True) |
| 42 | 36 |
|
| 37 |
+ mount = models.CharField(_(u'mount'), max_length=255, blank=True, null=True, help_text=u'卡口', db_index=True) |
|
| 43 | 38 |
code = models.CharField(_(u'code'), max_length=255, blank=True, null=True, help_text=u'机身码') |
| 44 | 39 |
code_status = models.BooleanField(_(u'code_status'), default=False, help_text=u'机身码状态, True已使用,False未使用', db_index=True) |
| 45 | 40 |
|
@@ -50,7 +45,7 @@ class ProductInfo(CreateUpdateMixin): |
||
| 50 | 45 |
clerk_id = models.CharField(_(u'clerk_id'), max_length=255, blank=True, null=True, help_text=u'店员唯一标识', db_index=True) |
| 51 | 46 |
|
| 52 | 47 |
consumer_name = models.CharField(_(u'consumer_name'), max_length=255, blank=True, null=True, help_text=u'消费者名称') |
| 53 |
- consumer_sex = models.IntegerField(_(u'consumer_sex'), choices=SEX_TYPE, default=MALE, help_text=u'消费者性别', db_index=True) |
|
| 48 |
+ consumer_sex = models.IntegerField(_(u'consumer_sex'), choices=SexChoicesMixin.SEX_TYPE, default=SexChoicesMixin.MALE, help_text=u'消费者性别', db_index=True) |
|
| 54 | 49 |
consumer_age = models.IntegerField(_(u'consumer_age'), default=0, help_text=u'消费者年龄') |
| 55 | 50 |
consumer_phone = models.CharField(_(u'consumer_phone'), max_length=255, blank=True, null=True, help_text=u'消费者联系电话') |
| 56 | 51 |
|
@@ -70,24 +65,17 @@ class ProductInfo(CreateUpdateMixin): |
||
| 70 | 65 |
} |
| 71 | 66 |
|
| 72 | 67 |
|
| 73 |
-class ProductCodeSubmitLogInfo(CreateUpdateMixin): |
|
| 74 |
- MALE = 1 |
|
| 75 |
- FEMALE = 0 |
|
| 76 |
- |
|
| 77 |
- SEX_TYPE = ( |
|
| 78 |
- (MALE, u'男'), |
|
| 79 |
- (FEMALE, u'女'), |
|
| 80 |
- ) |
|
| 81 |
- |
|
| 68 |
+class ProductCodeSubmitLogInfo(CreateUpdateMixin, SexChoicesMixin): |
|
| 82 | 69 |
model_id = models.CharField(_(u'model_id'), max_length=255, blank=True, null=True, help_text=u'型号唯一标识', db_index=True) |
| 83 | 70 |
model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称', db_index=True) |
| 71 |
+ mount = models.CharField(_(u'mount'), max_length=255, blank=True, null=True, help_text=u'卡口', db_index=True) |
|
| 84 | 72 |
code = models.CharField(_(u'code'), max_length=255, blank=True, null=True, help_text=u'机身码') |
| 85 | 73 |
|
| 86 | 74 |
franchiser_id = models.CharField(_(u'franchiser_id'), max_length=255, blank=True, null=True, help_text=u'经销商唯一标识', db_index=True) |
| 87 | 75 |
clerk_id = models.CharField(_(u'clerk_id'), max_length=255, blank=True, null=True, help_text=u'店员唯一标识', db_index=True) |
| 88 | 76 |
|
| 89 | 77 |
consumer_name = models.CharField(_(u'consumer_name'), max_length=255, blank=True, null=True, help_text=u'消费者名称') |
| 90 |
- consumer_sex = models.IntegerField(_(u'consumer_sex'), choices=SEX_TYPE, default=MALE, help_text=u'消费者性别', db_index=True) |
|
| 78 |
+ consumer_sex = models.IntegerField(_(u'consumer_sex'), choices=SexChoicesMixin.SEX_TYPE, default=SexChoicesMixin.MALE, help_text=u'消费者性别', db_index=True) |
|
| 91 | 79 |
consumer_age = models.IntegerField(_(u'consumer_age'), default=0, help_text=u'消费者年龄') |
| 92 | 80 |
consumer_phone = models.CharField(_(u'consumer_phone'), max_length=255, blank=True, null=True, help_text=u'消费者联系电话') |
| 93 | 81 |
|
@@ -11,3 +11,16 @@ class CreateUpdateMixin(models.Model): |
||
| 11 | 11 |
|
| 12 | 12 |
class Meta: |
| 13 | 13 |
abstract = True |
| 14 |
+ |
|
| 15 |
+ |
|
| 16 |
+class SexChoicesMixin(models.Model): |
|
| 17 |
+ MALE = 1 |
|
| 18 |
+ FEMALE = 0 |
|
| 19 |
+ |
|
| 20 |
+ SEX_TYPE = ( |
|
| 21 |
+ (MALE, u'男'), |
|
| 22 |
+ (FEMALE, u'女'), |
|
| 23 |
+ ) |
|
| 24 |
+ |
|
| 25 |
+ class Meta: |
|
| 26 |
+ abstract = True |