1
0
mirror of https://github.com/django/django.git synced 2024-12-27 03:25:58 +00:00

[1.8.x] Fixed #24220 - Allowed lazy objects for success_url

Backport of 511be35779 from master
This commit is contained in:
Tomáš Ehrlich 2015-01-26 11:09:50 +01:00 committed by Tim Graham
parent 2d990fb7fa
commit 5dff3513cc
2 changed files with 5 additions and 3 deletions

View File

@ -165,6 +165,8 @@ class ModelFormMixin(FormMixin, SingleObjectMixin):
Returns the supplied URL.
"""
if self.success_url:
# force_text can be removed with deprecation warning
self.success_url = force_text(self.success_url)
if PERCENT_PLACEHOLDER_REGEX.search(self.success_url):
warnings.warn(
"%()s placeholder style in success_url is deprecated. "
@ -299,6 +301,8 @@ class DeletionMixin(object):
def get_success_url(self):
if self.success_url:
# force_text can be removed with deprecation warning
self.success_url = force_text(self.success_url)
if PERCENT_PLACEHOLDER_REGEX.search(self.success_url):
warnings.warn(
"%()s placeholder style in success_url is deprecated. "

View File

@ -172,9 +172,7 @@ class SpecializedAuthorDelete(generic.DeleteView):
queryset = Author.objects.all()
template_name = 'generic_views/confirm_delete.html'
context_object_name = 'thingy'
def get_success_url(self):
return reverse('authors_list')
success_url = reverse_lazy('authors_list')
class BookConfig(object):