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 /docs/topics/cache.txt | |
| 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 'docs/topics/cache.txt')
| -rw-r--r-- | docs/topics/cache.txt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/topics/cache.txt b/docs/topics/cache.txt index d2aa8f98ec..6e6564d3e2 100644 --- a/docs/topics/cache.txt +++ b/docs/topics/cache.txt @@ -591,7 +591,7 @@ multiple URLs point at the same view, each URL will be cached separately. Continuing the ``my_view`` example, if your URLconf looks like this:: urlpatterns = [ - url(r'^foo/([0-9]{1,2})/$', my_view), + path('foo/<int:code>/', my_view), ] then requests to ``/foo/1/`` and ``/foo/23/`` will be cached separately, as @@ -637,7 +637,7 @@ Doing so is easy: simply wrap the view function with ``cache_page`` when you refer to it in the URLconf. Here's the old URLconf from earlier:: urlpatterns = [ - url(r'^foo/([0-9]{1,2})/$', my_view), + path('foo/<int:code>/', my_view), ] Here's the same thing, with ``my_view`` wrapped in ``cache_page``:: @@ -645,7 +645,7 @@ Here's the same thing, with ``my_view`` wrapped in ``cache_page``:: from django.views.decorators.cache import cache_page urlpatterns = [ - url(r'^foo/([0-9]{1,2})/$', cache_page(60 * 15)(my_view)), + path('foo/<int:code>/', cache_page(60 * 15)(my_view)), ] .. templatetag:: cache |
