summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Mispelon <bmispelon@gmail.com>2013-11-07 12:30:04 +0100
committerBaptiste Mispelon <bmispelon@gmail.com>2013-11-08 10:47:36 +0100
commitf2e0266be766b0b6149377b90ae3ddc41c91c3fb (patch)
tree2cddb372413fa1abf581092af6138c16c41fe08e
parent536c44782007bf35dd17c1fd2c8551cb4ddd967b (diff)
Fixed #21396: Document backwards-incompatible change in RedirectView.get_redirect_url.
Thanks to Tim for the review.
-rw-r--r--docs/ref/class-based-views/base.txt17
-rw-r--r--docs/releases/1.6.txt6
2 files changed, 20 insertions, 3 deletions
diff --git a/docs/ref/class-based-views/base.txt b/docs/ref/class-based-views/base.txt
index f0543e6095..44db131943 100644
--- a/docs/ref/class-based-views/base.txt
+++ b/docs/ref/class-based-views/base.txt
@@ -233,12 +233,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.
diff --git a/docs/releases/1.6.txt b/docs/releases/1.6.txt
index 10e202877f..9fa3349a67 100644
--- a/docs/releases/1.6.txt
+++ b/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
==========================