Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Russell Keith-Magee authored October 28, 2010

Showing 1 changed file with 8 additions and 4 deletions. Show diff stats Hide diff stats

  1. 12  django/views/generic/edit.py
12  django/views/generic/edit.py
@@ -143,7 +143,8 @@ def post(self, request, *args, **kwargs):
143 143
 
144 144
     # PUT is a valid HTTP verb for creating (with a known URL) or editing an
145 145
     # object, note that browsers only support POST for now.
146  
-    put = post
  146
+    def put(self, *args, **kwargs):
  147
+        return self.post(*args, **kwargs)
147 148
 
148 149
 
149 150
 class BaseFormView(FormMixin, ProcessFormView):
@@ -174,7 +175,8 @@ def post(self, request, *args, **kwargs):
174 175
 
175 176
     # PUT is a valid HTTP verb for creating (with a known URL) or editing an
176 177
     # object, note that browsers only support POST for now.
177  
-    put = post
  178
+    def put(self, *args, **kwargs):
  179
+        return self.post(*args, **kwargs)
178 180
 
179 181
 class CreateView(SingleObjectTemplateResponseMixin, BaseCreateView):
180 182
     """
@@ -200,7 +202,8 @@ def post(self, request, *args, **kwargs):
200 202
 
201 203
     # PUT is a valid HTTP verb for creating (with a known URL) or editing an
202 204
     # object, note that browsers only support POST for now.
203  
-    put = post
  205
+    def put(self, *args, **kwargs):
  206
+        return self.post(*args, **kwargs)
204 207
 
205 208
 
206 209
 class UpdateView(SingleObjectTemplateResponseMixin, BaseUpdateView):
@@ -223,7 +226,8 @@ def delete(self, request, *args, **kwargs):
223 226
         return HttpResponseRedirect(self.get_success_url())
224 227
 
225 228
     # Add support for browsers which only accept GET and POST for now.
226  
-    post = delete
  229
+    def post(self, *args, **kwargs):
  230
+        return self.delete(*args, **kwargs)
227 231
 
228 232
     def get_success_url(self):
229 233
         if self.success_url:

0 notes on commit 4c9741c

Please sign in to comment.
Something went wrong with that request. Please try again.