h_python_1368
h_python_1368

Reputation: 85

'User' object has no attribute 'get_all_permissions'

Upvotes: 0

Views: 2538

Answers (2)

Mohammed Jaseem Tp
Mohammed Jaseem Tp

Reputation: 118

Add these codes to your model.py

  1. Import PermissionsMixin from Django contrib Auth

    from django.contrib.auth.models import PermissionsMixin
    
  2. Then change

    class Account(AbstractBaseUser):
    
     to
    
    class Account(AbstractBaseUser, PermissionsMixin):
    

Then it will work fine

Upvotes: 5

Märuf
Märuf

Reputation: 55

Instead of returning self.is_superuser, return self.is_admin

def has_perm(self, perm, obj=None):
            return self.is_admin

def has_module_perms(self, app_label):
            return self.is_admin

will work I hope. :-) It's been one and half a year.

Upvotes: 1

Related Questions