Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.6.x] Fixed #21396: Document backwards-incompatible change in Redir…

…ectView.get_redirect_url.

Thanks to Tim for the review.

Backport of f2e0266 from master.
  • Loading branch information...
commit 6c34e18bd41237328b50177411809bd800fcab21 1 parent 6026a50
@bmispelon bmispelon authored
Showing with 20 additions and 3 deletions.
  1. +14 −3 docs/ref/class-based-views/base.txt
  2. +6 −0 docs/releases/1.6.txt
View
17 docs/ref/class-based-views/base.txt
@@ -239,12 +239,23 @@ RedirectView
**Methods**
- .. method:: get_redirect_url(**kwargs)
+ .. method:: get_redirect_url(*args, **kwargs)
Constructs the target URL for redirection.
+ .. versionchanged:: 1.6
+
+ The signature of this method was changed to include ``*args``.
+
The default implementation uses :attr:`url` as a starting
- string, performs expansion of ``%`` parameters in that string, as well
- as the appending of query string if requested by :attr:`query_string`.
+ string and performs expansion of ``%`` named parameters in that string
+ using the named groups captured in the URL.
+
+ If :attr:`url` is not set, ``get_redirect_url()`` tries to reverse the
+ :attr:`pattern_name` using what was captured in the URL (both named and
+ unnamed groups are used).
+
+ If requested by :attr:`query_string`, it will also append the query
+ string to the generated URL.
Subclasses may implement any behavior they wish, as long as the method
returns a redirect-ready URL string.
View
6 docs/releases/1.6.txt
@@ -913,6 +913,12 @@ Miscellaneous
been removed. Use ``socket.error`` provided by the standard library instead.
This change was also released in Django 1.5.5.
+* The signature of :meth:`django.views.generic.base.RedirectView.get_redirect_url`
+ has changed and now accepts positional arguments as well (``*args, **kwargs``).
+ Any unnamed captured group will now be passed to ``get_redirect_url()``
+ which may result in a ``TypeError`` if you don't update the signature of your
+ custom method.
+
Features deprecated in 1.6
==========================
Please sign in to comment.
Something went wrong with that request. Please try again.