mirror of
https://github.com/django/django.git
synced 2025-08-18 17:50:58 +00:00
[1.9.x] Fixed #26136 -- Removed URL reversing by dotted path from JavaScript catalog example.
Backport of 31817dd2eb
from master
This commit is contained in:
parent
204d31cd60
commit
e47f0c1247
2 changed files with 4 additions and 3 deletions
|
@ -988,7 +988,7 @@ You hook it up like this::
|
|||
}
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^jsi18n/$', javascript_catalog, js_info_dict),
|
||||
url(r'^jsi18n/$', javascript_catalog, js_info_dict, name='javascript-catalog'),
|
||||
]
|
||||
|
||||
Each string in ``packages`` should be in Python dotted-package syntax (the
|
||||
|
@ -1008,7 +1008,7 @@ changed by altering the ``domain`` argument.
|
|||
You can make the view dynamic by putting the packages into the URL pattern::
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^jsi18n/(?P<packages>\S+?)/$', javascript_catalog),
|
||||
url(r'^jsi18n/(?P<packages>\S+?)/$', javascript_catalog, name='javascript-catalog'),
|
||||
]
|
||||
|
||||
With this, you specify the packages as a list of package names delimited by '+'
|
||||
|
@ -1058,7 +1058,7 @@ To use the catalog, just pull in the dynamically generated script like this:
|
|||
|
||||
.. code-block:: html+django
|
||||
|
||||
<script type="text/javascript" src="{% url 'django.views.i18n.javascript_catalog' %}"></script>
|
||||
<script type="text/javascript" src="{% url 'javascript-catalog' %}"></script>
|
||||
|
||||
This uses reverse URL lookup to find the URL of the JavaScript catalog view.
|
||||
When the catalog is loaded, your JavaScript code can use the following methods:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue