mirror of
https://github.com/django/django.git
synced 2025-10-09 14:59:24 +00:00
This commit is contained in:
parent
0a09c60e97
commit
2514857e3f
@ -29,9 +29,9 @@ def builtin_template_path(name):
|
|||||||
|
|
||||||
def set_language(request):
|
def set_language(request):
|
||||||
"""
|
"""
|
||||||
Redirect to a given URL while setting the chosen language in the session
|
Redirect to a given URL while setting the chosen language in the language
|
||||||
(if enabled) and in a cookie. The URL and the language code need to be
|
cookie. The URL and the language code need to be specified in the request
|
||||||
specified in the request parameters.
|
parameters.
|
||||||
|
|
||||||
Since this view changes how the user will see the rest of the site, it must
|
Since this view changes how the user will see the rest of the site, it must
|
||||||
only be accessed as a POST request. If called as a GET request, it will
|
only be accessed as a POST request. If called as a GET request, it will
|
||||||
|
@ -1884,10 +1884,9 @@ Activate this view by adding the following line to your URLconf::
|
|||||||
language-independent itself to work correctly.
|
language-independent itself to work correctly.
|
||||||
|
|
||||||
The view expects to be called via the ``POST`` method, with a ``language``
|
The view expects to be called via the ``POST`` method, with a ``language``
|
||||||
parameter set in request. If session support is enabled, the view saves the
|
parameter set in request. The view saves the language choice in a cookie that
|
||||||
language choice in the user's session. It also saves the language choice in a
|
is named ``django_language`` by default. (The name can be changed through the
|
||||||
cookie that is named ``django_language`` by default. (The name can be changed
|
:setting:`LANGUAGE_COOKIE_NAME` setting.)
|
||||||
through the :setting:`LANGUAGE_COOKIE_NAME` setting.)
|
|
||||||
|
|
||||||
After setting the language choice, Django looks for a ``next`` parameter in the
|
After setting the language choice, Django looks for a ``next`` parameter in the
|
||||||
``POST`` or ``GET`` data. If that is found and Django considers it to be a safe
|
``POST`` or ``GET`` data. If that is found and Django considers it to be a safe
|
||||||
|
Loading…
x
Reference in New Issue
Block a user