models.py 1.2 KB

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