mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-30 18:09:59 +03:00
show_form_for_method
expects request object with appropriate method pre-attached
This commit is contained in:
parent
1154d873e9
commit
4179982dc9
|
@ -336,7 +336,7 @@ class BrowsableAPIRenderer(BaseRenderer):
|
||||||
return # Cannot use form overloading
|
return # Cannot use form overloading
|
||||||
|
|
||||||
try:
|
try:
|
||||||
view.check_permissions(clone_request(request, method))
|
view.check_permissions(request)
|
||||||
except exceptions.APIException:
|
except exceptions.APIException:
|
||||||
return False # Doesn't have permissions
|
return False # Doesn't have permissions
|
||||||
return True
|
return True
|
||||||
|
@ -379,7 +379,9 @@ class BrowsableAPIRenderer(BaseRenderer):
|
||||||
provide a form that can be used to submit arbitrary content.
|
provide a form that can be used to submit arbitrary content.
|
||||||
"""
|
"""
|
||||||
obj = getattr(view, 'object', None)
|
obj = getattr(view, 'object', None)
|
||||||
if not self.show_form_for_method(view, method, request, obj):
|
cloned_request = clone_request(request, method)
|
||||||
|
|
||||||
|
if not self.show_form_for_method(view, method, cloned_request, obj):
|
||||||
return
|
return
|
||||||
|
|
||||||
if method in ('DELETE', 'OPTIONS'):
|
if method in ('DELETE', 'OPTIONS'):
|
||||||
|
@ -413,7 +415,8 @@ class BrowsableAPIRenderer(BaseRenderer):
|
||||||
|
|
||||||
# Check permissions
|
# Check permissions
|
||||||
obj = getattr(view, 'object', None)
|
obj = getattr(view, 'object', None)
|
||||||
if not self.show_form_for_method(view, method, request, obj):
|
cloned_request = clone_request(request, method)
|
||||||
|
if not self.show_form_for_method(view, method, cloned_request, obj):
|
||||||
return
|
return
|
||||||
|
|
||||||
content_type_field = api_settings.FORM_CONTENTTYPE_OVERRIDE
|
content_type_field = api_settings.FORM_CONTENTTYPE_OVERRIDE
|
||||||
|
|
Loading…
Reference in New Issue
Block a user