mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-06 13:30:12 +03:00
In the BrowsableAPIRenderer the form now can be disabled
This commit is contained in:
parent
221a28ff92
commit
a14602b01f
|
@ -253,6 +253,12 @@ The name of a URL parameter that may be used to override the default `Accept` he
|
|||
|
||||
Default: `'format'`
|
||||
|
||||
#### SHOW_FORM
|
||||
|
||||
Show the form in the BrowsableAPIRenderer.
|
||||
|
||||
Default: `True`
|
||||
|
||||
---
|
||||
|
||||
## Date and time formatting
|
||||
|
|
|
@ -510,8 +510,11 @@ class BrowsableAPIRenderer(BaseRenderer):
|
|||
|
||||
def show_form_for_method(self, view, method, request, obj):
|
||||
"""
|
||||
Returns True if a form should be shown for this method.
|
||||
Returns True if a form should be shown for this method, or can be show at all.
|
||||
"""
|
||||
if not api_settings.SHOW_FORM:
|
||||
return False
|
||||
|
||||
if method not in view.allowed_methods:
|
||||
return # Not a valid method
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ DEFAULTS = {
|
|||
'FORM_CONTENTTYPE_OVERRIDE': '_content_type',
|
||||
'URL_ACCEPT_OVERRIDE': 'accept',
|
||||
'URL_FORMAT_OVERRIDE': 'format',
|
||||
'SHOW_FORM': True,
|
||||
|
||||
'FORMAT_SUFFIX_KWARG': 'format',
|
||||
'URL_FIELD_NAME': 'url',
|
||||
|
|
Loading…
Reference in New Issue
Block a user