Commit 3063a50f by Edmond Wong

Allow OPTIONS to retrieve PUT field metadata on empty objects

This allows OPTIONS to return the PUT endpoint's object serializer metadata when the object hasn't been created yet.
parent f8101114
......@@ -356,8 +356,13 @@ class GenericAPIView(views.APIView):
self.check_permissions(cloned_request)
# Test object permissions
if method == 'PUT':
self.get_object()
except (exceptions.APIException, PermissionDenied, Http404):
try:
self.get_object()
except Http404:
# Http404 should be acceptable and the serializer
# metadata should be populated.
pass
except (exceptions.APIException, PermissionDenied):
pass
else:
# If user has appropriate permissions for the view, include
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment