diff options
| author | Sjoerd Job Postmus <sjoerdjob@sjec.nl> | 2016-10-20 19:29:04 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-09-20 18:04:42 -0400 |
| commit | df41b5a05d4e00e80e73afe629072e37873e767a (patch) | |
| tree | baaf71ae695e2d3af604ea0d663284cb406c71e4 /django/template | |
| parent | c4c128d67c7dc2830631c6859a204c9d259f1fb1 (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 'django/template')
| -rw-r--r-- | django/template/defaulttags.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index ad2cec3432..5f56bb0d1f 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -1329,7 +1329,7 @@ def url(parser, token): {% url "url_name" name1=value1 name2=value2 %} - The first argument is a django.conf.urls.url() name. Other arguments are + The first argument is a URL pattern name. Other arguments are space-separated values that will be filled in place of positional and keyword arguments in the URL. Don't mix positional and keyword arguments. All arguments for the URL must be present. @@ -1337,12 +1337,12 @@ def url(parser, token): For example, if you have a view ``app_name.views.client_details`` taking the client's id and the corresponding line in a URLconf looks like this:: - url('^client/(\d+)/$', views.client_details, name='client-detail-view') + path('client/<int:id>/', views.client_details, name='client-detail-view') and this app's URLconf is included into the project's URLconf under some path:: - url('^clients/', include('app_name.urls')) + path('clients/', include('app_name.urls')) then in a template you can create a link for a certain client like this:: @@ -1359,7 +1359,7 @@ def url(parser, token): """ bits = token.split_contents() if len(bits) < 2: - raise TemplateSyntaxError("'%s' takes at least one argument, the name of a url()." % bits[0]) + raise TemplateSyntaxError("'%s' takes at least one argument, a URL pattern name." % bits[0]) viewname = parser.compile_filter(bits[1]) args = [] kwargs = {} |
