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.
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")
It seems it has to do with file permissions, not Django user permissions.