Commit 4c9741cb authored by Russell Keith-Magee's avatar Russell Keith-Magee
Browse files

Fixed #14558 -- Modified the way PUT and DELETE HTTP methods are handled so...

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
parent 623592e0
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -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: