|
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django_models_ext import BaseModelMixin
from TimeConvert import TimeConvert as tc
class MaintenacePointInfo(BaseModelMixin):
name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'名称')
province = models.CharField(_(u'province'), max_length=255, blank=True, null=True, help_text=u'省份')
location = models.CharField(_(u'location'), max_length=255, blank=True, null=True, help_text=u'地址')
postcode = models.CharField(_(u'postcode'), max_length=255, blank=True, null=True, help_text=u'邮政编码')
class Meta:
verbose_name = _(u'维修点信息')
verbose_name_plural = _(u'维修点信息')
def __unicode__(self):
return '%d' % self.pk
@property
def data(self):
return {
'id': self.pk,
'name': self.name,
'province': self.province,
'location': self.location,
'postcode': self.postcode,
}
class ExpressCompanyInfo(BaseModelMixin):
name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'名称')
class Meta:
verbose_name = _(u'快递公司信息')
verbose_name_plural = _(u'快递公司信息')
def __unicode__(self):
return '%d' % self.pk
@property
def data(self):
return {
'id': self.pk,
'name': self.name,
}
class MaintenaceInfo(BaseModelMixin):
user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'姓名')
phone = models.CharField(_(u'phone'), max_length=11, blank=True, null=True, help_text=u'电话')
address = models.CharField(_(u'address'), max_length=255, blank=True, null=True, help_text=u'地址')
sn = models.CharField(_(u'sn'), max_length=32, blank=True, null=True, help_text=u'序列号', db_index=True)
desc = models.TextField(_(u'desc'), blank=True, null=True, help_text=u'故障描述')
point_id = models.CharField(_(u'point_id'), max_length=32, blank=True, null=True, help_text=u'维修点唯一标识', db_index=True)
point_name = models.CharField(_(u'point_name'), max_length=255, blank=True, null=True, help_text=u'维修点名称')
express_name = models.CharField(_(u'express_name'), max_length=255, blank=True, null=True, help_text=u'快递公司名称')
tracking_number = models.CharField(_(u'tracking_number'), max_length=255, blank=True, null=True, help_text=u'快递单号')
maintenace_status = models.CharField(_(u'maintenace_status'), max_length=8, blank=True, null=True, help_text=u'维修状态')
class Meta:
verbose_name = _(u'维修信息')
verbose_name_plural = _(u'维修信息')
def __unicode__(self):
return '%d' % self.pk
@property
def data(self):
return {
'id': self.pk,
'user_id': self.user_id,
'name': self.name,
'phone': self.phone,
'address': self.address,
'sn': self.sn,
'desc': self.desc,
'point_id': self.point_id,
'point_name': self.point_name,
'express_name': self.express_name,
'tracking_number': self.tracking_number,
'maintenace_status': self.maintenace_status,
'created_at': tc.local_string(utc_dt=self.created_at),
'updated_at': tc.local_string(utc_dt=self.updated_at),
}
|