Geen omschrijving

models.py 4.7KB

    # -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from django_models_ext import BaseModelMixin, SexModelMixin from shortuuidfield import ShortUUIDField class ProductModelInfo(BaseModelMixin): model_id = ShortUUIDField(_(u'model_id'), max_length=32, help_text=u'型号唯一标识', db_index=True, unique=True) model_name = models.CharField(_(u'model_name'), max_length=32, blank=True, null=True, help_text=u'型号名称', unique=True) integral = models.IntegerField(_(u'integral'), default=0, help_text=u'型号积分') has_mount = models.BooleanField(_(u'has_mount'), default=True, help_text=u'是否有卡口', db_index=True) class Meta: verbose_name = _(u'产品型号信息') verbose_name_plural = _(u'产品型号信息') def __unicode__(self): return unicode(self.pk) @property def data(self): return { 'model_id': self.model_id, 'model_name': self.model_name, 'integral': self.integral, 'has_mount': self.has_mount, } class ProductInfo(BaseModelMixin, SexModelMixin): model_id = models.CharField(_(u'model_id'), max_length=32, blank=True, null=True, help_text=u'型号唯一标识', db_index=True) model_name = models.CharField(_(u'model_name'), max_length=32, blank=True, null=True, help_text=u'型号名称', db_index=True) mount = models.CharField(_(u'mount'), max_length=32, blank=True, null=True, help_text=u'卡口', db_index=True) code = models.CharField(_(u'code'), max_length=32, blank=True, null=True, help_text=u'机身码') code_status = models.BooleanField(_(u'code_status'), default=False, help_text=u'机身码状态, True已使用,False未使用', db_index=True) integral = models.IntegerField(_(u'integral'), default=0, help_text=u'积分') integral_status = models.BooleanField(_(u'integral_status'), default=False, help_text=u'积分状态, True已积分,False未积分', db_index=True) franchiser_id = models.CharField(_(u'franchiser_id'), max_length=32, blank=True, null=True, help_text=u'经销商唯一标识', db_index=True) clerk_id = models.CharField(_(u'clerk_id'), max_length=32, blank=True, null=True, help_text=u'店员唯一标识', db_index=True) consumer_name = models.CharField(_(u'consumer_name'), max_length=32, blank=True, null=True, help_text=u'消费者名称') consumer_sex = models.IntegerField(_(u'consumer_sex'), choices=SexModelMixin.SEX_TUPLE, default=SexModelMixin.MALE, help_text=u'消费者性别', db_index=True) consumer_age = models.IntegerField(_(u'consumer_age'), default=0, help_text=u'消费者年龄') consumer_phone = models.CharField(_(u'consumer_phone'), max_length=11, blank=True, null=True, help_text=u'消费者联系电话') class Meta: verbose_name = _(u'productinfo') verbose_name_plural = _(u'productinfo') def __unicode__(self): return unicode(self.pk) @property def data(self): return { 'model_id': self.model_id, 'model_name': self.model_name, 'code': self.code, } class ProductCodeSubmitLogInfo(BaseModelMixin, SexModelMixin): step = models.IntegerField(_(u'step'), default=1, help_text=u'提交步骤', db_index=True) model_id = models.CharField(_(u'model_id'), max_length=32, blank=True, null=True, help_text=u'型号唯一标识', db_index=True) model_name = models.CharField(_(u'model_name'), max_length=32, blank=True, null=True, help_text=u'型号名称', db_index=True) mount = models.CharField(_(u'mount'), max_length=255, blank=True, null=True, help_text=u'卡口', db_index=True) code = models.CharField(_(u'code'), max_length=32, blank=True, null=True, help_text=u'机身码') franchiser_id = models.CharField(_(u'franchiser_id'), max_length=32, blank=True, null=True, help_text=u'经销商唯一标识', db_index=True) clerk_id = models.CharField(_(u'clerk_id'), max_length=32, blank=True, null=True, help_text=u'店员唯一标识', db_index=True) consumer_name = models.CharField(_(u'consumer_name'), max_length=32, blank=True, null=True, help_text=u'消费者名称') consumer_sex = models.IntegerField(_(u'consumer_sex'), choices=SexModelMixin.SEX_TUPLE, default=SexModelMixin.MALE, help_text=u'消费者性别', db_index=True) consumer_age = models.IntegerField(_(u'consumer_age'), default=0, help_text=u'消费者年龄') consumer_phone = models.CharField(_(u'consumer_phone'), max_length=11, blank=True, null=True, help_text=u'消费者联系电话') class Meta: verbose_name = _(u'productcodesubmitloginfo') verbose_name_plural = _(u'productcodesubmitloginfo') def __unicode__(self): return unicode(self.pk)