Fixed #19605 - Removed unused url imports from doc examples.
Thanks sergzach for the suggestion.
This commit is contained in:
parent
2f8ab2f1b0
commit
43f89e0ad6
|
@ -176,7 +176,7 @@ decouple URLs from Python code.
|
||||||
Here's what a URLconf might look like for the ``Reporter``/``Article``
|
Here's what a URLconf might look like for the ``Reporter``/``Article``
|
||||||
example above::
|
example above::
|
||||||
|
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
(r'^articles/(\d{4})/$', 'news.views.year_archive'),
|
(r'^articles/(\d{4})/$', 'news.views.year_archive'),
|
||||||
|
|
|
@ -1928,7 +1928,7 @@ In this example, we register the default ``AdminSite`` instance
|
||||||
``django.contrib.admin.site`` at the URL ``/admin/`` ::
|
``django.contrib.admin.site`` at the URL ``/admin/`` ::
|
||||||
|
|
||||||
# urls.py
|
# urls.py
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns, include
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
admin.autodiscover()
|
admin.autodiscover()
|
||||||
|
@ -1944,7 +1944,7 @@ In this example, we register the ``AdminSite`` instance
|
||||||
``myproject.admin.admin_site`` at the URL ``/myadmin/`` ::
|
``myproject.admin.admin_site`` at the URL ``/myadmin/`` ::
|
||||||
|
|
||||||
# urls.py
|
# urls.py
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns, include
|
||||||
from myproject.admin import admin_site
|
from myproject.admin import admin_site
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
@ -1968,7 +1968,7 @@ separate versions of the admin site -- using the ``AdminSite`` instances
|
||||||
respectively::
|
respectively::
|
||||||
|
|
||||||
# urls.py
|
# urls.py
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns, include
|
||||||
from myproject.admin import basic_site, advanced_site
|
from myproject.admin import basic_site, advanced_site
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
|
@ -141,7 +141,7 @@ enable it in your project's ``urls.py``:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns
|
||||||
from django.contrib.comments.feeds import LatestCommentFeed
|
from django.contrib.comments.feeds import LatestCommentFeed
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
|
@ -256,7 +256,7 @@ Example
|
||||||
|
|
||||||
Here's an example of a :doc:`URLconf </topics/http/urls>` using both::
|
Here's an example of a :doc:`URLconf </topics/http/urls>` using both::
|
||||||
|
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns
|
||||||
from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap
|
from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap
|
||||||
from blog.models import Entry
|
from blog.models import Entry
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ latest five news items::
|
||||||
To connect a URL to this feed, put an instance of the Feed object in
|
To connect a URL to this feed, put an instance of the Feed object in
|
||||||
your :doc:`URLconf </topics/http/urls>`. For example::
|
your :doc:`URLconf </topics/http/urls>`. For example::
|
||||||
|
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns
|
||||||
from myproject.feeds import LatestEntriesFeed
|
from myproject.feeds import LatestEntriesFeed
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
@ -321,7 +321,7 @@ Here's a full example::
|
||||||
|
|
||||||
And the accompanying URLconf::
|
And the accompanying URLconf::
|
||||||
|
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns
|
||||||
from myproject.feeds import RssSiteNewsFeed, AtomSiteNewsFeed
|
from myproject.feeds import RssSiteNewsFeed, AtomSiteNewsFeed
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
|
@ -601,7 +601,7 @@ pattern, it's possible to give a name to a pattern, and then reference the name
|
||||||
rather than the view function. A named URL pattern is defined by replacing the
|
rather than the view function. A named URL pattern is defined by replacing the
|
||||||
pattern tuple by a call to the ``url`` function)::
|
pattern tuple by a call to the ``url`` function)::
|
||||||
|
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import url
|
||||||
|
|
||||||
url(r'^people/(\d+)/$', 'blog_views.generic_detail', name='people_view'),
|
url(r'^people/(\d+)/$', 'blog_views.generic_detail', name='people_view'),
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ Now we need to define a view::
|
||||||
Finally hook that view into your urls::
|
Finally hook that view into your urls::
|
||||||
|
|
||||||
# urls.py
|
# urls.py
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns, url
|
||||||
from books.views import PublisherList
|
from books.views import PublisherList
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
|
@ -37,7 +37,7 @@ URLconf. If you're only changing a few simple attributes on a class-based view,
|
||||||
you can simply pass them into the
|
you can simply pass them into the
|
||||||
:meth:`~django.views.generic.base.View.as_view` method call itself::
|
:meth:`~django.views.generic.base.View.as_view` method call itself::
|
||||||
|
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
@ -73,7 +73,7 @@ point the URL to the :meth:`~django.views.generic.base.View.as_view` class
|
||||||
method instead, which provides a function-like entry to class-based views::
|
method instead, which provides a function-like entry to class-based views::
|
||||||
|
|
||||||
# urls.py
|
# urls.py
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns
|
||||||
from some_app.views import AboutView
|
from some_app.views import AboutView
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
|
|
|
@ -66,7 +66,7 @@ Example
|
||||||
|
|
||||||
Here's a sample URLconf::
|
Here's a sample URLconf::
|
||||||
|
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
(r'^articles/2003/$', 'news.views.special_case_2003'),
|
(r'^articles/2003/$', 'news.views.special_case_2003'),
|
||||||
|
@ -255,7 +255,7 @@ code duplication.
|
||||||
|
|
||||||
Here's the example URLconf from the :doc:`Django overview </intro/overview>`::
|
Here's the example URLconf from the :doc:`Django overview </intro/overview>`::
|
||||||
|
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
(r'^articles/(\d{4})/$', 'news.views.year_archive'),
|
(r'^articles/(\d{4})/$', 'news.views.year_archive'),
|
||||||
|
@ -270,7 +270,7 @@ each view function.
|
||||||
|
|
||||||
With this in mind, the above example can be written more concisely as::
|
With this in mind, the above example can be written more concisely as::
|
||||||
|
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns
|
||||||
|
|
||||||
urlpatterns = patterns('news.views',
|
urlpatterns = patterns('news.views',
|
||||||
(r'^articles/(\d{4})/$', 'year_archive'),
|
(r'^articles/(\d{4})/$', 'year_archive'),
|
||||||
|
@ -291,7 +291,7 @@ Just add multiple ``patterns()`` objects together, like this:
|
||||||
|
|
||||||
Old::
|
Old::
|
||||||
|
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
(r'^$', 'myapp.views.app_index'),
|
(r'^$', 'myapp.views.app_index'),
|
||||||
|
@ -301,7 +301,7 @@ Old::
|
||||||
|
|
||||||
New::
|
New::
|
||||||
|
|
||||||
from django.conf.urls import patterns, url, include
|
from django.conf.urls import patterns
|
||||||
|
|
||||||
urlpatterns = patterns('myapp.views',
|
urlpatterns = patterns('myapp.views',
|
||||||
(r'^$', 'app_index'),
|
(r'^$', 'app_index'),
|
||||||
|
|
Loading…
Reference in New Issue