Skip to content

Commit 7c945b4

Browse files
committed
Only use object permissions in browsable api form generation if an object exists
1 parent 4802177 commit 7c945b4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rest_framework/renderers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ def show_form_for_method(self, view, method, request, obj):
349349

350350
try:
351351
view.check_permissions(request)
352-
view.check_object_permissions(request, obj)
352+
if obj is not None:
353+
view.check_object_permissions(request, obj)
353354
except exceptions.APIException:
354355
return False # Doesn't have permissions
355356
return True

0 commit comments

Comments
 (0)