🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
* 新建数据模型`PageRoles`和`UserProfile` 修改文件`/api/models.py` ```python from django.db import models from django.contrib.auth.models import AbstractUser # 页面权限表 class PageRoles(models.Model): name = models.CharField("角色", max_length=100, unique=True, null=True, blank=True) roles = models.CharField("权限", max_length=500, null=True, blank=True) operator = models.CharField("最后操作人ID", max_length=20, null=True, blank=True) credate = models.DateTimeField("创建时间", auto_now_add=True, null=True, blank=True) edidate = models.DateTimeField("修改时间", auto_now=True, null=True, blank=True) class Meta: verbose_name = "页面权限表" verbose_name_plural = verbose_name # 用户扩展表 class UserProfile(AbstractUser): TYPE_CHOICES = ( (1, '管理员'), (2, '分销员'), (3, '会员'), (4, '非会员') ) nickname = models.CharField("昵称", max_length=300, null=True, blank=True) name = models.CharField("姓名", max_length=20, null=True, blank=True) img_url = models.CharField("头像", max_length=300, null=True, blank=True) type = models.IntegerField("类型", choices=TYPE_CHOICES, null=True, blank=True) level = models.IntegerField("等级", null=True, blank=True) id_card = models.CharField("身份证号", max_length=100, unique=True, null=True, blank=True) phone = models.CharField("手机", max_length=100, unique=True, null=True, blank=True) weixin_id = models.CharField("微信ID", max_length=100, unique=True, null=True, blank=True) alipay_id = models.CharField("支付宝ID", max_length=100, unique=True, null=True, blank=True) roles = models.CharField("页面权限", max_length=500, null=True, blank=True) class Meta: verbose_name = "用户扩展表" verbose_name_plural = verbose_name ```