Skip to content
This repository was archived by the owner on Apr 9, 2022. It is now read-only.

Commit 97041ab

Browse files
committed
handle none object permission case
1 parent 6a06ddf commit 97041ab

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server/server/api/permissions.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ def has_permission(self, request, view):
1919
def has_object_permission(self, request, view, obj=None):
2020
"""Only the author can modify existing instances."""
2121
is_safe = request.method in SAFE_METHODS
22-
is_author = request.user == obj.author
22+
23+
try:
24+
is_author = request.user == obj.author
25+
except AttributeError:
26+
is_author = False
2327

2428
return is_safe or is_author or request.user.is_superuser

0 commit comments

Comments
 (0)