mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-29 21:14:01 +03:00
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.
This commit is contained in:
parent
f8101114d1
commit
3063a50fc2
|
@ -356,8 +356,13 @@ class GenericAPIView(views.APIView):
|
||||||
self.check_permissions(cloned_request)
|
self.check_permissions(cloned_request)
|
||||||
# Test object permissions
|
# Test object permissions
|
||||||
if method == 'PUT':
|
if method == 'PUT':
|
||||||
self.get_object()
|
try:
|
||||||
except (exceptions.APIException, PermissionDenied, Http404):
|
self.get_object()
|
||||||
|
except Http404:
|
||||||
|
# Http404 should be acceptable and the serializer
|
||||||
|
# metadata should be populated.
|
||||||
|
pass
|
||||||
|
except (exceptions.APIException, PermissionDenied):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
# If user has appropriate permissions for the view, include
|
# If user has appropriate permissions for the view, include
|
||||||
|
|
Loading…
Reference in New Issue
Block a user