New permission to exclude DJ.
This commit is contained in:
parent
d3f13e470f
commit
30ea69ac93
1 changed files with 11 additions and 1 deletions
|
@ -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