diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-10-28 02:59:04 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-10-28 02:59:04 +0000 |
| commit | 4c9741cba2e88b46252e08037047df34aad48c70 (patch) | |
| tree | d199b9bffca7ce7a1e234f5f52c5f1c5dbbdb31e | |
| parent | 623592e0acd87a5d2be500f83bb483518057c377 (diff) | |
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
| -rw-r--r-- | django/views/generic/edit.py | 12 |
1 files 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: |
