summaryrefslogtreecommitdiff
path: root/docs/ref/templates
diff options
context:
space:
mode:
authorSjoerd Job Postmus <sjoerdjob@sjec.nl>2016-10-20 19:29:04 +0200
committerTim Graham <timograham@gmail.com>2017-09-20 18:04:42 -0400
commitdf41b5a05d4e00e80e73afe629072e37873e767a (patch)
treebaaf71ae695e2d3af604ea0d663284cb406c71e4 /docs/ref/templates
parentc4c128d67c7dc2830631c6859a204c9d259f1fb1 (diff)
Fixed #28593 -- Added a simplified URL routing syntax per DEP 0201.
Thanks Aymeric Augustin for shepherding the DEP and patch review. Thanks Marten Kenbeek and Tim Graham for contributing to the code. Thanks Tom Christie, Shai Berger, and Tim Graham for the docs.
Diffstat (limited to 'docs/ref/templates')
-rw-r--r--docs/ref/templates/builtins.txt18
1 files changed, 9 insertions, 9 deletions
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
index c4ad02f529..49e07aeec2 100644
--- a/docs/ref/templates/builtins.txt
+++ b/docs/ref/templates/builtins.txt
@@ -1115,11 +1115,11 @@ hard-code URLs in your templates::
{% url 'some-url-name' v1 v2 %}
-The first argument is a :func:`~django.conf.urls.url` ``name``. It can be a
-quoted literal or any other context variable. Additional arguments are optional
-and should be space-separated values that will be used as arguments in the URL.
-The example above shows passing positional arguments. Alternatively you may
-use keyword syntax::
+The first argument is a :ref:`URL pattern name <naming-url-patterns>`. It can
+be a quoted literal or any other context variable. Additional arguments are
+optional and should be space-separated values that will be used as arguments in
+the URL. The example above shows passing positional arguments. Alternatively
+you may use keyword syntax::
{% url 'some-url-name' arg1=v1 arg2=v2 %}
@@ -1132,14 +1132,14 @@ takes a client ID (here, ``client()`` is a method inside the views file
.. code-block:: python
- ('^client/([0-9]+)/$', app_views.client, name='app-views-client')
+ path('client/<int:id>/', app_views.client, name='app-views-client')
If this app's URLconf is included into the project's URLconf under a path
such as this:
.. code-block:: python
- ('^clients/', include('project_name.app_name.urls'))
+ path('clients/', include('project_name.app_name.urls'))
...then, in a template, you can create a link to this view like this::
@@ -1179,8 +1179,8 @@ by the context as to the current application.
.. warning::
- Don't forget to put quotes around the :func:`~django.conf.urls.url`
- ``name``, otherwise the value will be interpreted as a context variable!
+ Don't forget to put quotes around the URL pattern ``name``, otherwise the
+ value will be interpreted as a context variable!
.. templatetag:: verbatim