New permission to exclude DJ.
This commit is contained in:
parent
d3f13e470f
commit
30ea69ac93
1 changed files with 11 additions and 1 deletions
|
@ -32,7 +32,7 @@ class IsAdminOwnerOrReadOnly(permissions.BasePermission):
|
|||
else:
|
||||
if request.user.is_authenticated:
|
||||
return ((request.user.is_staff or
|
||||
request.user == obj.user) and
|
||||
request.user == obj.user) and
|
||||
not request.user.is_dj)
|
||||
else:
|
||||
return False
|
||||
|
@ -46,3 +46,13 @@ class IsDJ(permissions.BasePermission):
|
|||
return request.user.is_dj
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
class IsAuthenticatedAndNotDJ(permissions.BasePermission):
|
||||
message = 'Only an authenticated user can make changes to this object.'
|
||||
|
||||
def has_permission(self, request, view):
|
||||
if request.user.is_authenticated:
|
||||
return not request.user.is_dj
|
||||
else:
|
||||
return False
|
||||
|
|
Loading…
Reference in a new issue