我使用自定义用户,我想使用django-guardian来处理权限和组。我如何做到这一点,我的用户:
class ProfileUser(AbstractBaseUser, PermissionsMixin):
email = models.EmailField(_('email address'), unique=True)
is_staff = models.BooleanField(default=False)
is_active = models.BooleanField(default=True)
date_joined = models.DateTimeField(default=timezone.now)
username = models.CharField(max_length=255,unique=True)
first_name=models.CharField(max_length=255)
last_name= models.CharField(max_length=255)
departement= models.CharField(max_length=255)
USERNAME_FIELD = 'username'
REQUIRED_FIELDS = []发布于 2020-06-26 08:54:47
只需在ProfileUser模型中添加一个指向实际用户的OneToOne字段,或者使用in the django documentation about extending the user model.包含的任何其他方法
https://stackoverflow.com/questions/62585667
复制相似问题