I am trying to restrict access to pages using 2 user levels. Superuser and administrator. The superuser is a regular Django user with "is_superuser" assigned. The Admin user is also a regular user who is assigned only the permission of 'is_staff'.
The problem is that when I use this decorator for the admin user, it does not pass the test:
@permission_required('is_staff') def my_view(....)
@permission_required('is_staff') returns false for anonymous users. (Right)
@permission_required('is_superuser') returns true only for superusers (correct)
@permission_required('is_staff') returns FALSE for users with the assigned variable 'is_staff'. (Wrong).
Any thoughts?
django decorator admin permissions
Dim Apr 29 2018-11-11T00: 00Z
source share