[1.7.x] Fixed #23578 -- Changed examples in docs to use patterns
This commit is contained in:
parent
e9c8aefbce
commit
74c38bad1d
|
@ -834,25 +834,25 @@ displaying polls.
|
||||||
.. snippet::
|
.. snippet::
|
||||||
:filename: urls.py
|
:filename: urls.py
|
||||||
|
|
||||||
from django.conf.urls import include, url
|
from django.conf.urls import include, patterns, url
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = patterns('',
|
||||||
url(r'^author-polls/', include('polls.urls', namespace='author-polls', app_name='polls')),
|
url(r'^author-polls/', include('polls.urls', namespace='author-polls', app_name='polls')),
|
||||||
url(r'^publisher-polls/', include('polls.urls', namespace='publisher-polls', app_name='polls')),
|
url(r'^publisher-polls/', include('polls.urls', namespace='publisher-polls', app_name='polls')),
|
||||||
]
|
)
|
||||||
|
|
||||||
.. snippet::
|
.. snippet::
|
||||||
:filename: polls/urls.py
|
:filename: polls/urls.py
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.conf.urls import patterns, url
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = patterns('',
|
||||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||||
url(r'^(?P<pk>\d+)/$', views.DetailView.as_view(), name='detail'),
|
url(r'^(?P<pk>\d+)/$', views.DetailView.as_view(), name='detail'),
|
||||||
...
|
...
|
||||||
]
|
)
|
||||||
|
|
||||||
Using this setup, the following lookups are possible:
|
Using this setup, the following lookups are possible:
|
||||||
|
|
||||||
|
@ -921,14 +921,14 @@ However, you can also ``include()`` a 3-tuple containing::
|
||||||
|
|
||||||
For example::
|
For example::
|
||||||
|
|
||||||
from django.conf.urls import include, url
|
from django.conf.urls import include, patterns, url
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
polls_patterns = [
|
polls_patterns = patterns('',
|
||||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||||
url(r'^(?P<pk>\d+)/$', views.DetailView.as_view(), name='detail'),
|
url(r'^(?P<pk>\d+)/$', views.DetailView.as_view(), name='detail'),
|
||||||
]
|
)
|
||||||
|
|
||||||
url(r'^polls/', include((polls_patterns, 'polls', 'author-polls'))),
|
url(r'^polls/', include((polls_patterns, 'polls', 'author-polls'))),
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue