123456789101112131415161718192021222324252627 |
- from django.db import models
- from django.contrib.auth.models import AbstractUser
- from utils.models import BaseModel
- class User(AbstractUser):
- # | 字段 | 类型 | 约束 | 栏位 |
- # | ------------ | -------- | -------------------- |: ------- |
- # | mobile | 字符类型 | 长度11,唯一不能重复 | 手机号码 |
- # | email_active | 布尔类型 | 默认值False, | 激活状态 |
- mobile = models.CharField(max_length=11,unique=True,verbose_name="手机号")
- effective_date = models.DateTimeField(null=True, blank=True,verbose_name="账号有效期")
- email_active = models.BooleanField(default=False,verbose_name="邮箱激活状态")
- # default_address = models.ForeignKey('Address', related_name='usersjiu', null=True, blank=True, on_delete=models.SET_NULL, verbose_name='默认地址')
- class Meta:
- verbose_name = '用户信息'
- verbose_name_plural = verbose_name
- permissions = (
- ("contens_firstadvertisement_getlist", "查看广告分类"),
- ("users_UserTotalCountView_getlist", "统计用户总人数"),
- )
- db_table = "web_users"
- def __str__(self):
- return self.username
|