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:
Daniele Varrazzo 2017-09-04 10:04:48 +01:00 committed by Tom Christie
parent 7cd59147ea
commit e42eb42d49

View File

@ -579,7 +579,8 @@ class BrowsableAPIRenderer(BaseRenderer):
_content = forms.CharField(
label='Content',
widget=forms.Textarea(attrs={'data-override': 'content'}),
initial=content
initial=content,
required=False
)
return GenericContentForm()