summaryrefslogtreecommitdiff
path: root/docs/ref/class-based-views/base.txt
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/class-based-views/base.txt
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/class-based-views/base.txt')
-rw-r--r--docs/ref/class-based-views/base.txt16
1 files changed, 8 insertions, 8 deletions
diff --git a/docs/ref/class-based-views/base.txt b/docs/ref/class-based-views/base.txt
index 6230f1181e..6ef72176c3 100644
--- a/docs/ref/class-based-views/base.txt
+++ b/docs/ref/class-based-views/base.txt
@@ -40,12 +40,12 @@ MRO is an acronym for Method Resolution Order.
**Example urls.py**::
- from django.conf.urls import url
+ from django.urls import path
from myapp.views import MyView
urlpatterns = [
- url(r'^mine/$', MyView.as_view(), name='my-view'),
+ path('mine/', MyView.as_view(), name='my-view'),
]
**Attributes**
@@ -144,12 +144,12 @@ MRO is an acronym for Method Resolution Order.
**Example urls.py**::
- from django.conf.urls import url
+ from django.urls import path
from myapp.views import HomePageView
urlpatterns = [
- url(r'^$', HomePageView.as_view(), name='home'),
+ path('', HomePageView.as_view(), name='home'),
]
**Context**
@@ -208,15 +208,15 @@ MRO is an acronym for Method Resolution Order.
**Example urls.py**::
- from django.conf.urls import url
+ from django.urls import path
from django.views.generic.base import RedirectView
from article.views import ArticleCounterRedirectView, ArticleDetail
urlpatterns = [
- url(r'^counter/(?P<pk>[0-9]+)/$', ArticleCounterRedirectView.as_view(), name='article-counter'),
- url(r'^details/(?P<pk>[0-9]+)/$', ArticleDetail.as_view(), name='article-detail'),
- url(r'^go-to-django/$', RedirectView.as_view(url='https://djangoproject.com'), name='go-to-django'),
+ path('counter/<int:pk>/', ArticleCounterRedirectView.as_view(), name='article-counter'),
+ path('details/<int:pk>/', ArticleDetail.as_view(), name='article-detail'),
+ path('go-to-django/', RedirectView.as_view(url='https://djangoproject.com'), name='go-to-django'),
]
**Attributes**