From f25cc73fa165fb7fc2e3552305740ffc7c658ade Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Tue, 29 Aug 2017 17:13:35 +0100 Subject: [PATCH] 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. --- rest_framework/renderers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest_framework/renderers.py b/rest_framework/renderers.py index 779f0dd44..687cb0e1e 100644 --- a/rest_framework/renderers.py +++ b/rest_framework/renderers.py @@ -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()