Skip to content

Commit e42eb42

Browse files
dvarrazzolovelydinosaur
authored andcommitted
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.
1 parent 7cd5914 commit e42eb42

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

rest_framework/renderers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,8 @@ class GenericContentForm(forms.Form):
579579
_content = forms.CharField(
580580
label='Content',
581581
widget=forms.Textarea(attrs={'data-override': 'content'}),
582-
initial=content
582+
initial=content,
583+
required=False
583584
)
584585

585586
return GenericContentForm()

0 commit comments

Comments
 (0)