Don't fill in the form after a DELETE.

This commit is contained in:
Marko Tibold 2012-09-08 22:01:12 +02:00
parent 55f7dd9bce
commit 59a0bc55af

View File

@ -255,7 +255,7 @@ class DocumentingTemplateRenderer(BaseRenderer):
for k, v in serializer.fields.items(): for k, v in serializer.fields.items():
fields[k] = field_mapping[v.__class__.__name__]() fields[k] = field_mapping[v.__class__.__name__]()
OnTheFlyForm = type("OnTheFlyForm", (forms.Form,), fields) OnTheFlyForm = type("OnTheFlyForm", (forms.Form,), fields)
if object: if object and not self.view.request.method == 'DELETE': # Don't fill in the form when the object is deleted
data = serializer.data data = serializer.data
form_instance = OnTheFlyForm(data) form_instance = OnTheFlyForm(data)
return form_instance return form_instance