diff --git a/django/views/generic/edit.py b/django/views/generic/edit.py index 6f514c3a703..a4329a25b04 100644 --- a/django/views/generic/edit.py +++ b/django/views/generic/edit.py @@ -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. " diff --git a/tests/generic_views/views.py b/tests/generic_views/views.py index 27ae5b2ca9d..fe7fb88876a 100644 --- a/tests/generic_views/views.py +++ b/tests/generic_views/views.py @@ -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):