Blame view
apps/account/models.py
868 Bytes
c51fd49af first add |
1 2 3 4 5 6 7 8 |
# coding: utf-8 from django.db import models from django.contrib.auth.models import AbstractUser # 数据库表结构 |
f96567709 modify page |
9 |
class SysUser(models.Model): |
c51fd49af first add |
10 11 12 13 |
''' django.contrib.auth.models.User 默认User类字段太少,用AbstractUser 自定义一个User类,增加字段 ''' |
f96567709 modify page |
14 15 |
suid = models.IntegerField(u'uid', primary_key=True) user_name = models.CharField(u'用户名', max_length=20, unique=True) |
1a597f51f add login token |
16 17 18 19 20 |
level = models.IntegerField(u'level') create_time = models.DateTimeField() status = models.IntegerField() last_login_ip = models.CharField(max_length=20) last_login_time = models.DateTimeField() |
c51fd49af first add |
21 |
|
f96567709 modify page |
22 23 |
USERNAME_FIELD = 'user_name' REQUIRED_FIELDS = ['suid'] |
c51fd49af first add |
24 |
def __unicode__(self): |
1a597f51f add login token |
25 |
return self.user_name |
c51fd49af first add |
26 27 |
class Meta(object): |
1a597f51f add login token |
28 |
db_table = 'sys_user' |
c51fd49af first add |
29 |
verbose_name = verbose_name_plural = u'用户' |