class User(models.Model):
name = models.CharField(max_length=32)
pwd = models.CharField(max_length=32)
roles = models.ManyToManyField(to="Role")
def __str__(self): return self.name
class Role(models.Model):
title = models.CharField(max_length=32)
permissions = models.ManyToManyField(to="Permission")
def __str__(self): return self.title
class Permission(models.Model):
title = models.CharField(max_length=32)
url = models.CharField(max_length=64)
def __str__(self): return self.title
rbac权限-model
![](https://img-home.csdnimg.cn/images/20240711042549.png)