mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-25 11:04:02 +03:00
Don't make the content mandatory in the generic content form (#5372)
Sometimes, probably in the upgrade from Django 1.9 to 1.10, a post with empty content is forbidden by javascript, with the message "Please fill in this field". Filling the form with '{}' allows an application/json request to be submitted. The API call itself works perfectly well with a post with empty content: the interface shouldn't make assumptions about it.
This commit is contained in:
parent
7cd59147ea
commit
e42eb42d49
|
@ -579,7 +579,8 @@ class BrowsableAPIRenderer(BaseRenderer):
|
||||||
_content = forms.CharField(
|
_content = forms.CharField(
|
||||||
label='Content',
|
label='Content',
|
||||||
widget=forms.Textarea(attrs={'data-override': 'content'}),
|
widget=forms.Textarea(attrs={'data-override': 'content'}),
|
||||||
initial=content
|
initial=content,
|
||||||
|
required=False
|
||||||
)
|
)
|
||||||
|
|
||||||
return GenericContentForm()
|
return GenericContentForm()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user