Exception: fix detail/code for exception.

This commit is contained in:
Tom Hacohen 2020-10-01 16:45:47 +03:00
parent 6214688170
commit 06f2dd72a7

View File

@ -574,7 +574,8 @@ class InvitationOutgoingViewSet(InvitationBaseViewSet):
return Response(content, status=status.HTTP_400_BAD_REQUEST)
if not permissions.is_collection_admin(collection, request.user):
raise PermissionDenied('User is not an admin of this collection')
raise PermissionDenied({'code': 'admin_access_required',
'detail': 'User is not an admin of this collection'})
serializer.save(collection=collection)