mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 11:33:59 +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)
|
||||
# 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
|
||||
|
|
Loading…
Reference in New Issue
Block a user