From 4c9741cba2e88b46252e08037047df34aad48c70 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 28 Oct 2010 02:59:04 +0000 Subject: [PATCH] Fixed #14558 -- Modified the way PUT and DELETE HTTP methods are handled so that overridden methods will get used correctly. Thanks to pyrou for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14374 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/views/generic/edit.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/django/views/generic/edit.py b/django/views/generic/edit.py index 680d52bccc..d607091f55 100644 --- a/django/views/generic/edit.py +++ b/django/views/generic/edit.py @@ -143,7 +143,8 @@ class ProcessFormView(View): # PUT is a valid HTTP verb for creating (with a known URL) or editing an # object, note that browsers only support POST for now. - put = post + def put(self, *args, **kwargs): + return self.post(*args, **kwargs) class BaseFormView(FormMixin, ProcessFormView): @@ -174,7 +175,8 @@ class BaseCreateView(ModelFormMixin, ProcessFormView): # PUT is a valid HTTP verb for creating (with a known URL) or editing an # object, note that browsers only support POST for now. - put = post + def put(self, *args, **kwargs): + return self.post(*args, **kwargs) class CreateView(SingleObjectTemplateResponseMixin, BaseCreateView): """ @@ -200,7 +202,8 @@ class BaseUpdateView(ModelFormMixin, ProcessFormView): # PUT is a valid HTTP verb for creating (with a known URL) or editing an # object, note that browsers only support POST for now. - put = post + def put(self, *args, **kwargs): + return self.post(*args, **kwargs) class UpdateView(SingleObjectTemplateResponseMixin, BaseUpdateView): @@ -223,7 +226,8 @@ class DeletionMixin(object): return HttpResponseRedirect(self.get_success_url()) # Add support for browsers which only accept GET and POST for now. - post = delete + def post(self, *args, **kwargs): + return self.delete(*args, **kwargs) def get_success_url(self): if self.success_url: