12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- from django.db import models
- from django.utils.translation import ugettext_lazy as _
- from models_ext import BaseModelMixin
- from shortuuidfield import ShortUUIDField
- class BrandInfo(BaseModelMixin):
- brand_id = ShortUUIDField(_(u'brand_id'), max_length=32, help_text=u'品牌唯一标识', db_index=True, unique=True)
- brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')
- brand_descr = models.TextField(_(u'brand_descr'), max_length=255, blank=True, null=True, help_text=u'品牌描述')
- position = models.IntegerField(_(u'position'), default=1, help_text=u'排序')
- class Meta:
- verbose_name = _(u'品牌信息')
- verbose_name_plural = _(u'品牌信息')
- def __unicode__(self):
- return unicode(self.pk)
- @property
- def data(self):
- return {
- 'brand_id': self.brand_id,
- 'brand_name': self.brand_name,
- 'brand_descr': self.brand_descr,
- }
- class ModelInfo(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=255, blank=True, null=True, help_text=u'型号名称')
- model_descr = models.TextField(_(u'model_descr'), max_length=255, blank=True, null=True, help_text=u'型号描述')
- position = models.IntegerField(_(u'position'), default=1, help_text=u'排序')
- 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,
- 'model_descr': self.model_descr,
- }
- class DistributorInfo(BaseModelMixin):
- distributor_id = ShortUUIDField(_(u'distributor_id'), max_length=32, help_text=u'经销商唯一标识', db_index=True, unique=True)
- distributor_name = models.CharField(_(u'distributor_name'), max_length=255, blank=True, null=True, help_text=u'经销商名称')
- distributor_descr = models.TextField(_(u'distributor_descr'), max_length=255, blank=True, null=True, help_text=u'经销商描述')
- position = models.IntegerField(_(u'position'), default=1, help_text=u'排序')
- class Meta:
- verbose_name = _(u'经销商信息')
- verbose_name_plural = _(u'经销商信息')
- def __unicode__(self):
- return unicode(self.pk)
- @property
- def data(self):
- return {
- 'distributor_id': self.distributor_id,
- 'distributor_name': self.distributor_name,
- 'distributor_descr': self.distributor_descr,
- }
|