Fixed #26295 -- Allowed using i18n_patterns() in any root URLconf.

Thanks Tim for the review.
This commit is contained in:
Simon Charette 2015-12-14 12:36:09 -05:00
parent 2404d209a5
commit d0451e4cad
4 changed files with 34 additions and 12 deletions

View file

@ -244,7 +244,9 @@ Generic Views
Internationalization
~~~~~~~~~~~~~~~~~~~~
* ...
* The :func:`~django.conf.urls.i18n.i18n_patterns` helper function can now be
used in a root URLConf specified using :attr:`request.urlconf
<django.http.HttpRequest.urlconf>`.
Management Commands
~~~~~~~~~~~~~~~~~~~

View file

@ -1328,7 +1328,7 @@ Language prefix in URL patterns
.. function:: i18n_patterns(*pattern_list)
This function can be used in your root URLconf and Django will automatically
This function can be used in a root URLconf and Django will automatically
prepend the current active language code to all url patterns defined within
:func:`~django.conf.urls.i18n.i18n_patterns`. Example URL patterns::
@ -1373,10 +1373,16 @@ function. Example::
.. warning::
:func:`~django.conf.urls.i18n.i18n_patterns` is only allowed in your root
:func:`~django.conf.urls.i18n.i18n_patterns` is only allowed in a root
URLconf. Using it within an included URLconf will throw an
:exc:`~django.core.exceptions.ImproperlyConfigured` exception.
.. versionchanged:: 1.10
In older version, using ``i18n_patterns`` in a root URLconf different from
:setting:`ROOT_URLCONF` by setting :attr:`request.urlconf
<django.http.HttpRequest.urlconf>` wasn't supported.
.. warning::
Ensure that you don't have non-prefixed URL patterns that might collide