From 59a0bc55af871a538843d1a6dd2442d374bd8b26 Mon Sep 17 00:00:00 2001 From: Marko Tibold Date: Sat, 8 Sep 2012 22:01:12 +0200 Subject: [PATCH] Don't fill in the form after a DELETE. --- djangorestframework/renderers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/djangorestframework/renderers.py b/djangorestframework/renderers.py index a94fcd5c5..6d00c4c5c 100644 --- a/djangorestframework/renderers.py +++ b/djangorestframework/renderers.py @@ -255,7 +255,7 @@ class DocumentingTemplateRenderer(BaseRenderer): for k, v in serializer.fields.items(): fields[k] = field_mapping[v.__class__.__name__]() 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 form_instance = OnTheFlyForm(data) return form_instance