mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 12:30:11 +03:00
Don't make the content mandatory in the generic content form
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
1c5710bf6c
commit
f25cc73fa1
|
@ -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