summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-02-19 09:22:18 +0000
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-02-19 09:22:18 +0000
commit4d959686e66feac9871304be80945270ccc3742d (patch)
treed7a5cc54c12e955b720eba4855fe0309dbd9ccd6
parent25b5da2abdebef867f1e38c95f5622df3741d0db (diff)
[1.3.X] Fixed #17319 -- Made the example for set_language less error-prone. Backport of r17560 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.3.X@17561 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--docs/topics/i18n/internationalization.txt8
1 files changed, 6 insertions, 2 deletions
diff --git a/docs/topics/i18n/internationalization.txt b/docs/topics/i18n/internationalization.txt
index a83299c1e8..807c6c53ea 100644
--- a/docs/topics/i18n/internationalization.txt
+++ b/docs/topics/i18n/internationalization.txt
@@ -763,7 +763,8 @@ The ``set_language`` redirect view
.. function:: set_language(request)
As a convenience, Django comes with a view, :func:`django.views.i18n.set_language`,
-that sets a user's language preference and redirects back to the previous page.
+that sets a user's language preference and redirects to a given URL or, by default,
+back to the previous page.
Activate this view by adding the following line to your URLconf::
@@ -792,7 +793,7 @@ Here's example HTML template code:
<form action="/i18n/setlang/" method="post">
{% csrf_token %}
- <input name="next" type="hidden" value="/next/page/" />
+ <input name="next" type="hidden" value="{{ redirect_to }}" />
<select name="language">
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
@@ -801,3 +802,6 @@ Here's example HTML template code:
</select>
<input type="submit" value="Go" />
</form>
+
+In this example, Django looks up the URL of the page to which the user will be
+redirected in the ``redirect_to`` context variable.