Code

Ticket #16129: patch.diff

File patch.diff, 1.2 KB (added by renatopedigoni, 3 years ago)
Line 
1Index: django/views/generic/edit.py
2===================================================================
3--- django/views/generic/edit.py        (revision 16297)
4+++ django/views/generic/edit.py        (working copy)
5@@ -1,6 +1,6 @@
6 from django.forms import models as model_forms
7 from django.core.exceptions import ImproperlyConfigured
8-from django.http import HttpResponseRedirect
9+from django.shortcuts import redirect
10 from django.views.generic.base import TemplateResponseMixin, View
11 from django.views.generic.detail import (SingleObjectMixin,
12                         SingleObjectTemplateResponseMixin, BaseDetailView)
13@@ -57,7 +57,7 @@
14         return url
15 
16     def form_valid(self, form):
17-        return HttpResponseRedirect(self.get_success_url())
18+        return redirect(self.get_success_url())
19 
20     def form_invalid(self, form):
21         return self.render_to_response(self.get_context_data(form=form))
22@@ -212,7 +212,7 @@
23     def delete(self, request, *args, **kwargs):
24         self.object = self.get_object()
25         self.object.delete()
26-        return HttpResponseRedirect(self.get_success_url())
27+        return redirect(self.get_success_url())
28 
29     # Add support for browsers which only accept GET and POST for now.
30     def post(self, *args, **kwargs):