|
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from pai2.basemodels import CreateUpdateMixin
class LensmanInfo(CreateUpdateMixin):
MALE = 0
FEMALE = 1
SEX_TYPE = (
(MALE, u'男'),
(FEMALE, u'女'),
)
lensman_id = models.CharField(_(u'lensman_id'), max_length=255, blank=True, null=True, help_text=u'摄影师唯一标识', db_index=True, unique=True)
username = models.CharField(_(u'username'), max_length=255, blank=True, null=True, help_text=u'摄影师用户名', db_index=True, unique=True)
password = models.CharField(_(u'password'), max_length=255, blank=True, null=True, help_text=u'摄影师密码')
encryption = models.CharField(_(u'encryption'), max_length=255, blank=True, null=True, help_text=u'摄影师密码')
name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'摄影师姓名')
sex = models.IntegerField(_(u'sex'), choices=SEX_TYPE, default=MALE, help_text=u'摄影师性别')
phone = models.CharField(_(u'phone'), max_length=255, blank=True, null=True, help_text=u'摄影师电话', db_index=True, unique=True)
location = models.CharField(_(u'location'), max_length=255, blank=True, null=True, help_text=u'摄影师地址')
proportion = models.FloatField(_(u'proportion'), default=1.0, help_text=u'摄影师分成比例(0.0 ~ 1.0)')
signup_ip = models.CharField(_(u'signup_ip'), max_length=255, blank=True, null=True, help_text=_(u'注册IP'))
login_ip = models.CharField(_(u'login_ip'), max_length=255, blank=True, null=True, help_text=_(u'登录IP'))
login_at = models.DateTimeField(_(u'login_at'), blank=True, null=True, help_text=_(u'登录时间'))
class Meta:
verbose_name = _(u'lensmaninfo')
verbose_name_plural = _(u'lensmaninfo')
def __unicode__(self):
return unicode(self.pk)
class LensmanLoginLogInfo(CreateUpdateMixin):
SUCCESS = 0
PWD_ERROR = 1
OTHER = 2
LOGIN_RESULT = (
(SUCCESS, u'登录成功'),
(PWD_ERROR, u'密码错误'),
(OTHER, u'其他'),
)
lensman_id = models.CharField(_(u'lensman_id'), max_length=255, blank=True, null=True, help_text=u'摄影师唯一标识', db_index=True)
login_ip = models.CharField(_(u'login_ip'), max_length=255, blank=True, null=True, help_text=_(u'登录IP'))
login_result = models.IntegerField(_(u'login_result'), choices=LOGIN_RESULT, default=SUCCESS)
class Meta:
verbose_name = _(u'lensmanloginloginfo')
verbose_name_plural = _(u'lensmanloginloginfo')
def __unicode__(self):
return unicode(self.pk)
class UserInfo(CreateUpdateMixin):
UNVERIFIED = 0
ACTIVATED = 1
DISABLED = 2
DELETED = 3
ASSIGN = 10
USER_STATUS = (
(UNVERIFIED, u'未验证'),
(ACTIVATED, u'已激活'),
(DISABLED, u'已禁用'),
(DELETED, u'已删除'),
(ASSIGN, u'已分配'),
)
MALE = 0
FEMALE = 1
SEX_TYPE = (
(MALE, u'男'),
(FEMALE, u'女'),
)
user_id = models.CharField(_(u'user_id'), max_length=255, blank=True, null=True, help_text=u'用户唯一标识', db_index=True, unique=True)
username = models.CharField(_(u'username'), max_length=255, blank=True, null=True, help_text=u'用户用户名', db_index=True, unique=True)
password = models.CharField(_(u'password'), max_length=255, blank=True, null=True, help_text=u'用户密码')
name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'用户姓名')
sex = models.IntegerField(_(u'sex'), choices=SEX_TYPE, default=MALE, help_text=u'用户性别')
phone = models.CharField(_(u'phone'), max_length=255, blank=True, null=True, help_text=u'用户电话', db_index=True, unique=True)
location = models.CharField(_(u'location'), max_length=255, blank=True, null=True, help_text=u'用户地址')
user_status = models.IntegerField(_(u'user_status'), choices=USER_STATUS, default=UNVERIFIED)
signup_ip = models.CharField(_(u'signup_ip'), max_length=255, blank=True, null=True, help_text=_(u'注册IP'))
login_ip = models.CharField(_(u'login_ip'), max_length=255, blank=True, null=True, help_text=_(u'登录IP'))
login_at = models.DateTimeField(_(u'login_at'), blank=True, null=True, help_text=_(u'登录时间'))
class Meta:
verbose_name = _(u'userinfo')
verbose_name_plural = _(u'userinfo')
def __unicode__(self):
return unicode(self.pk)
def _data(self):
return {
'user_id': self.user_id,
'username': self.username,
}
data = property(_data)
class UserLoginLogInfo(CreateUpdateMixin):
SUCCESS = 0
PWD_ERROR = 1
OTHER = 2
LOGIN_RESULT = (
(SUCCESS, u'登录成功'),
(PWD_ERROR, u'密码错误'),
(OTHER, u'其他'),
)
user_id = models.CharField(_(u'user_id'), max_length=255, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
login_ip = models.CharField(_(u'login_ip'), max_length=255, blank=True, null=True, help_text=_(u'登录IP'))
login_result = models.IntegerField(_(u'login_result'), choices=LOGIN_RESULT, default=SUCCESS)
class Meta:
verbose_name = _(u'userloginloginfo')
verbose_name_plural = _(u'userloginloginfo')
def __unicode__(self):
return unicode(self.pk)
|