New permission to exclude DJ.

This commit is contained in:
Josh Washburne 2018-04-09 12:08:23 -04:00
parent d3f13e470f
commit 30ea69ac93

View file

@ -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