Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #14558 -- Modified the way PUT and DELETE HTTP methods are hand…

…led 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
  • Loading branch information...
commit 4c9741cba2e88b46252e08037047df34aad48c70 1 parent 623592e
@freakboy3742 freakboy3742 authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 django/views/generic/edit.py
View
12 django/views/generic/edit.py
@@ -143,7 +143,8 @@ def post(self, request, *args, **kwargs):
# 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 @@ def post(self, request, *args, **kwargs):
# 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 @@ def post(self, request, *args, **kwargs):
# 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 @@ def delete(self, request, *args, **kwargs):
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:
Please sign in to comment.
Something went wrong with that request. Please try again.