mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-16 19:41:06 +03:00
Use cleaned_content instead of raw_content when generating a form instance for the DocumentingTemplateEmitter. This allows the form to be prepopulated with the resource's existing values.
This commit is contained in:
parent
23d924eb9b
commit
39c0c07786
|
@ -227,7 +227,7 @@ class DocumentingTemplateEmitter(BaseEmitter):
|
||||||
# Otherwise if we have a response that is valid against the form then use that
|
# Otherwise if we have a response that is valid against the form then use that
|
||||||
if not form_instance and resource.response.has_content_body:
|
if not form_instance and resource.response.has_content_body:
|
||||||
try:
|
try:
|
||||||
form_instance = resource.get_bound_form(resource.response.raw_content)
|
form_instance = resource.get_bound_form(resource.response.cleaned_content)
|
||||||
if form_instance and not form_instance.is_valid():
|
if form_instance and not form_instance.is_valid():
|
||||||
form_instance = None
|
form_instance = None
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user