Getting "permission Denied" Page In The Admin, While User Has Permission
I've got some issue with user permissions in Django. I added some permissions for the Magasin model as shown below: add_magasin=Permission.objects.get(codename='add_magasin') chang
Solution 1:
The first argument of User.has_perm()
have to be a string in <app label>.<permission codename>
format. In you're code you're passing Permission
instance as first argument, which get's evaluated to <app_label> | <content_type> | <name>
, so has_perm
will always return False
.
Instead use user.has_perm("<yourapp>.delete_magasin")
Post a Comment for "Getting "permission Denied" Page In The Admin, While User Has Permission"