From df41b5a05d4e00e80e73afe629072e37873e767a Mon Sep 17 00:00:00 2001 From: Sjoerd Job Postmus Date: Thu, 20 Oct 2016 19:29:04 +0200 Subject: 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. --- docs/ref/class-based-views/base.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'docs/ref/class-based-views/base.txt') 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[0-9]+)/$', ArticleCounterRedirectView.as_view(), name='article-counter'), - url(r'^details/(?P[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//', ArticleCounterRedirectView.as_view(), name='article-counter'), + path('details//', ArticleDetail.as_view(), name='article-detail'), + path('go-to-django/', RedirectView.as_view(url='https://djangoproject.com'), name='go-to-django'), ] **Attributes** -- cgit v1.3