+ options={
+ 'verbose_name': '\u4ea7\u54c1\u578b\u53f7\u4fe1\u606f',
+ 'verbose_name_plural': '\u4ea7\u54c1\u578b\u53f7\u4fe1\u606f',
+ },
+ ),
+ ]
@@ -0,0 +1,88 @@ |
||
| 1 |
+# -*- coding: utf-8 -*- |
|
| 2 |
+ |
|
| 3 |
+from django.db import models |
|
| 4 |
+from django.utils.translation import ugettext_lazy as _ |
|
| 5 |
+from models_ext import BaseModelMixin, SexModelMixin |
|
| 6 |
+from shortuuidfield import ShortUUIDField |
|
| 7 |
+ |
|
| 8 |
+ |
|
| 9 |
+class ProductModelInfo(BaseModelMixin): |
|
| 10 |
+ model_id = ShortUUIDField(_(u'model_id'), max_length=32, help_text=u'型号唯一标识', db_index=True, unique=True) |
|
| 11 |
+ model_name = models.CharField(_(u'model_name'), max_length=32, blank=True, null=True, help_text=u'型号名称', unique=True) |
|
| 12 |
+ integral = models.IntegerField(_(u'integral'), default=0, help_text=u'型号积分') |
|
| 13 |
+ has_mount = models.BooleanField(_(u'has_mount'), default=True, help_text=u'是否有卡口', db_index=True) |
|
| 14 |
+ |
|
| 15 |
+ class Meta: |
|
| 16 |
+ verbose_name = _(u'产品型号信息') |
|
| 17 |
+ verbose_name_plural = _(u'产品型号信息') |
|
| 18 |
+ |
|
| 19 |
+ def __unicode__(self): |
|
| 20 |
+ return unicode(self.pk) |
|
| 21 |
+ |
|
| 22 |
+ @property |
|
| 23 |
+ def data(self): |
|
| 24 |
+ return {
|
|
| 25 |
+ 'model_id': self.model_id, |
|
| 26 |
+ 'model_name': self.model_name, |
|
| 27 |
+ 'integral': self.integral, |
|
| 28 |
+ 'has_mount': self.has_mount, |
|
| 29 |
+ } |
|
| 30 |
+ |
|
| 31 |
+ |
|
| 32 |
+class ProductInfo(BaseModelMixin, SexModelMixin): |
|
| 33 |
+ model_id = models.CharField(_(u'model_id'), max_length=32, blank=True, null=True, help_text=u'型号唯一标识', db_index=True) |
|
| 34 |
+ model_name = models.CharField(_(u'model_name'), max_length=32, blank=True, null=True, help_text=u'型号名称', db_index=True) |
|
| 35 |
+ |
|
| 36 |
+ mount = models.CharField(_(u'mount'), max_length=32, blank=True, null=True, help_text=u'卡口', db_index=True) |
|
| 37 |
+ code = models.CharField(_(u'code'), max_length=32, blank=True, null=True, help_text=u'机身码') |
|
| 38 |
+ code_status = models.BooleanField(_(u'code_status'), default=False, help_text=u'机身码状态, True已使用,False未使用', db_index=True) |
|
| 39 |
+ |
|
| 40 |
+ integral = models.IntegerField(_(u'integral'), default=0, help_text=u'积分') |
|
| 41 |
+ integral_status = models.BooleanField(_(u'integral_status'), default=False, help_text=u'积分状态, True已积分,False未积分', db_index=True) |
|
| 42 |
+ |
|
| 43 |
+ franchiser_id = models.CharField(_(u'franchiser_id'), max_length=32, blank=True, null=True, help_text=u'经销商唯一标识', db_index=True) |
|
| 44 |
+ clerk_id = models.CharField(_(u'clerk_id'), max_length=32, blank=True, null=True, help_text=u'店员唯一标识', db_index=True) |
|
| 45 |
+ |
|
| 46 |
+ consumer_name = models.CharField(_(u'consumer_name'), max_length=32, blank=True, null=True, help_text=u'消费者名称') |
|
| 47 |
+ consumer_sex = models.IntegerField(_(u'consumer_sex'), choices=SexModelMixin.SEX_TUPLE, default=SexModelMixin.MALE, help_text=u'消费者性别', db_index=True) |
|
| 48 |
+ consumer_age = models.IntegerField(_(u'consumer_age'), default=0, help_text=u'消费者年龄') |
|
| 49 |
+ consumer_phone = models.CharField(_(u'consumer_phone'), max_length=11, blank=True, null=True, help_text=u'消费者联系电话') |
|
| 50 |
+ |
|
| 51 |
+ class Meta: |
|
| 52 |
+ verbose_name = _(u'productinfo') |
|
| 53 |
+ verbose_name_plural = _(u'productinfo') |
|
| 54 |
+ |
|
| 55 |
+ def __unicode__(self): |
|
| 56 |
+ return unicode(self.pk) |
|
| 57 |
+ |
|
| 58 |
+ @property |
|
| 59 |
+ def data(self): |
|
| 60 |
+ return {
|
|
| 61 |
+ 'model_id': self.model_id, |
|
| 62 |
+ 'model_name': self.model_name, |
|
| 63 |
+ 'code': self.code, |
|
| 64 |
+ } |
|
| 65 |
+ |
|
| 66 |
+ |
|
| 67 |
+class ProductCodeSubmitLogInfo(BaseModelMixin, SexModelMixin): |
|
| 68 |
+ step = models.IntegerField(_(u'step'), default=1, help_text=u'提交步骤', db_index=True) |
|
| 69 |
+ |
|
| 70 |
+ model_id = models.CharField(_(u'model_id'), max_length=32, blank=True, null=True, help_text=u'型号唯一标识', db_index=True) |
|
| 71 |
+ model_name = models.CharField(_(u'model_name'), max_length=32, blank=True, null=True, help_text=u'型号名称', db_index=True) |
|
| 72 |
+ mount = models.CharField(_(u'mount'), max_length=255, blank=True, null=True, help_text=u'卡口', db_index=True) |
|
| 73 |
+ code = models.CharField(_(u'code'), max_length=32, blank=True, null=True, help_text=u'机身码') |
|
| 74 |
+ |
|
| 75 |
+ franchiser_id = models.CharField(_(u'franchiser_id'), max_length=32, blank=True, null=True, help_text=u'经销商唯一标识', db_index=True) |
|
| 76 |
+ clerk_id = models.CharField(_(u'clerk_id'), max_length=32, blank=True, null=True, help_text=u'店员唯一标识', db_index=True) |
|
| 77 |
+ |
|
| 78 |
+ consumer_name = models.CharField(_(u'consumer_name'), max_length=32, blank=True, null=True, help_text=u'消费者名称') |
|
| 79 |
+ consumer_sex = models.IntegerField(_(u'consumer_sex'), choices=SexModelMixin.SEX_TUPLE, default=SexModelMixin.MALE, help_text=u'消费者性别', db_index=True) |
|
| 80 |
+ consumer_age = models.IntegerField(_(u'consumer_age'), default=0, help_text=u'消费者年龄') |
|
| 81 |
+ consumer_phone = models.CharField(_(u'consumer_phone'), max_length=11, blank=True, null=True, help_text=u'消费者联系电话') |
|
| 82 |
+ |
|
| 83 |
+ class Meta: |
|
| 84 |
+ verbose_name = _(u'productcodesubmitloginfo') |
|
| 85 |
+ verbose_name_plural = _(u'productcodesubmitloginfo') |
|
| 86 |
+ |
|
| 87 |
+ def __unicode__(self): |
|
| 88 |
+ return unicode(self.pk) |
@@ -0,0 +1,4 @@ |
||
| 1 |
+from django.test import TestCase |
|
| 2 |
+ |
|
| 3 |
+ |
|
| 4 |
+# Create your tests here. |
@@ -0,0 +1,4 @@ |
||
| 1 |
+from django.shortcuts import render |
|
| 2 |
+ |
|
| 3 |
+ |
|
| 4 |
+# Create your views here. |
@@ -3,6 +3,34 @@ |
||
| 3 | 3 |
from StatusCode import BaseStatusCode, StatusCodeField |
| 4 | 4 |
|
| 5 | 5 |
|
| 6 |
+class FranchiserStatusCode(BaseStatusCode): |
|
| 7 |
+ """ 经销商相关错误码 5000xx """ |
|
| 8 |
+ CHISER_NOT_FOUND = StatusCodeField(500001, 'Chiser Not Found', description=u'经销商不存在') |
|
| 9 |
+ |
|
| 10 |
+ |
|
| 11 |
+class SaleclerkStatusCode(BaseStatusCode): |
|
| 12 |
+ """ 店员相关错误码 5001xx """ |
|
| 13 |
+ CLERK_NOT_FOUND = StatusCodeField(500101, 'Clerk Not Found', description=u'店员不存在') |
|
| 14 |
+ # 手机号 |
|
| 15 |
+ CLERK_PHONE_ALREADY_EXISTS = StatusCodeField(500105, 'Clerk Phone Already Exists', description=u'手机号已经存在') |
|
| 16 |
+ # 状态 |
|
| 17 |
+ CLERK_ALREADY_NOT_UNVERIFIED = StatusCodeField(500110, 'Clerk Already Not Unverified', description=u'店员帐号已激活') |
|
| 18 |
+ CLERK_NOT_ACTIVATED = StatusCodeField(500115, 'Clerk Not Activated', description=u'店员帐号未激活') |
|
| 19 |
+ |
|
| 20 |
+ |
|
| 21 |
+class ProductModelStatusCode(BaseStatusCode): |
|
| 22 |
+ """ 型号相关错误码 5010xx """ |
|
| 23 |
+ MODEL_NOT_FOUND = StatusCodeField(501001, 'Model Not Found', description=u'型号不存在') |
|
| 24 |
+ |
|
| 25 |
+ |
|
| 26 |
+class ProductStatusCode(BaseStatusCode): |
|
| 27 |
+ """ 产品相关错误码 5020xx """ |
|
| 28 |
+ PRODUCT_NOT_FOUND = StatusCodeField(502001, 'Product Not Found', description=u'产品不存在') |
|
| 29 |
+ # 状态 |
|
| 30 |
+ PRODUCT_HAS_USED = StatusCodeField(502011, 'Product Has Used', description=u'产品已使用') |
|
| 31 |
+ PRODUCT_NOT_USED = StatusCodeField(502012, 'Product Not Used', description=u'产品未使用') |
|
| 32 |
+ |
|
| 33 |
+ |
|
| 6 | 34 |
class LensmanStatusCode(BaseStatusCode): |
| 7 | 35 |
""" 摄影师相关错误码 4000xx """ |
| 8 | 36 |
LENSMAN_NOT_FOUND = StatusCodeField(400001, 'Lensman Not Found', description=u'摄影师不存在') |