Django: Integrating Permission and Group Functions into a User User Model

I created a custom model for my django applications. Now I want to use the django system and the group system. I made permissions and groups, but when I use them in my user model take errors like

>>> john.groups.add(special_users)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'MyCustomUserModel' object has no attribute 'groups'

I assume that I need to add additional code to my user model to integrate this function Can anyone help with this problem?

+4
source share
1 answer

Finally, MyCustomUserModel had to inherit from PermissionsMixin

class MyCustomUserModel(AbstractBaseUser,PermissionsMixin):
+6
source

All Articles