权限
1 创建表
权限组件下的models.py
class User(models.Model): username = models.CharField(max_length=32) password = models.CharField(max_length=32) roles = models.ManyToManyField("Role") def __str__(self): return self.username # 角色表 class Role(models.Model): name = models.CharField(max_length=32) permissions = models.ManyToManyField("Permission") def __str__(self): return self.name # 权限 class Permission(models.Model): title = models.CharField(max_length=32) urls = models.CharField(max_length=64) code = models.CharField(max_length=32) def __str__(self): return self.title