summaryrefslogtreecommitdiff
path: root/docs/intro
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2011-09-11 22:36:16 +0000
committerRamiro Morales <cramm0@gmail.com>2011-09-11 22:36:16 +0000
commit26b812208751edf87b4df0aee00996c5c7bcd4c9 (patch)
tree0857822a7dbd27f459b9dfe2075bf194a3e16ce8 /docs/intro
parentfd9045346286208c0dbd0afc1f820e868910dac8 (diff)
Fixed #14675 -- Completed removal of `from django.conf.urls.default import *` usage.
This applies to both our own [test] code and documentation examples. Also: * Moved the functions and handlers from `django.conf.urls.defaults` up to `django.conf.urls` deprecating the former module. * Added documentation for `handler403`. * Tweaked the URLs topic document a bit. Thanks to pupeno and cdestigter for their great work contributing patches. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16818 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/intro')
-rw-r--r--docs/intro/overview.txt2
-rw-r--r--docs/intro/tutorial02.txt2
-rw-r--r--docs/intro/tutorial03.txt30
-rw-r--r--docs/intro/tutorial04.txt10
4 files changed, 22 insertions, 22 deletions
diff --git a/docs/intro/overview.txt b/docs/intro/overview.txt
index 34572a6c80..737db21866 100644
--- a/docs/intro/overview.txt
+++ b/docs/intro/overview.txt
@@ -176,7 +176,7 @@ decouple URLs from Python code.
Here's what a URLconf might look like for the ``Reporter``/``Article``
example above::
- from django.conf.urls.defaults import *
+ from django.conf.urls import patterns, url, include
urlpatterns = patterns('',
(r'^articles/(\d{4})/$', 'news.views.year_archive'),
diff --git a/docs/intro/tutorial02.txt b/docs/intro/tutorial02.txt
index 2c625a73a5..589e11f617 100644
--- a/docs/intro/tutorial02.txt
+++ b/docs/intro/tutorial02.txt
@@ -40,7 +40,7 @@ activate the admin site for your installation, do these three things:
.. parsed-literal::
- from django.conf.urls.defaults import patterns, include, url
+ from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
**from django.contrib import admin**
diff --git a/docs/intro/tutorial03.txt b/docs/intro/tutorial03.txt
index 82cf60b118..a489a77930 100644
--- a/docs/intro/tutorial03.txt
+++ b/docs/intro/tutorial03.txt
@@ -78,7 +78,7 @@ point at that file::
Time for an example. Edit ``mysite/urls.py`` so it looks like this::
- from django.conf.urls.defaults import patterns, include, url
+ from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
@@ -367,7 +367,7 @@ special: It's just a normal view.
You normally won't have to bother with writing 404 views. By default, URLconfs
have the following line up top::
- from django.conf.urls.defaults import patterns, include, url
+ from django.conf.urls import patterns, include, url
That takes care of setting ``handler404`` in the current module. As you can see
in ``django/conf/urls/defaults.py``, ``handler404`` is set to
@@ -443,7 +443,7 @@ Namely, ``polls.views`` is in every callback.
Because this is a common case, the URLconf framework provides a shortcut for
common prefixes. You can factor out the common prefixes and add them as the
-first argument to :func:`~django.conf.urls.defaults.patterns`, like so::
+first argument to :func:`~django.conf.urls.patterns`, like so::
urlpatterns = patterns('polls.views',
(r'^polls/$', 'index'),
@@ -457,21 +457,21 @@ tidier.
Since you generally don't want the prefix for one app to be applied to every
callback in your URLconf, you can concatenate multiple
-:func:`~django.conf.urls.defaults.patterns`. Your full ``mysite/urls.py`` might
+:func:`~django.conf.urls.patterns`. Your full ``mysite/urls.py`` might
now look like this::
- from django.conf.urls.defaults import patterns, include, url
+ from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
-
+
urlpatterns = patterns('polls.views',
(r'^polls/$', 'index'),
(r'^polls/(?P<poll_id>\d+)/$', 'detail'),
(r'^polls/(?P<poll_id>\d+)/results/$', 'results'),
(r'^polls/(?P<poll_id>\d+)/vote/$', 'vote'),
)
-
+
urlpatterns += patterns('',
url(r'^admin/', include(admin.site.urls)),
)
@@ -494,23 +494,23 @@ URLs within the app directory.
Copy the file ``mysite/urls.py`` to ``polls/urls.py``. Then, change
``mysite/urls.py`` to remove the poll-specific URLs and insert an
-:func:`~django.conf.urls.defaults.include`, leaving you with::
+:func:`~django.conf.urls.include`, leaving you with::
# This also imports the include function
- from django.conf.urls.defaults import patterns, include, url
-
+ from django.conf.urls import patterns, include, url
+
from django.contrib import admin
admin.autodiscover()
-
+
urlpatterns = patterns('',
(r'^polls/', include('polls.urls')),
url(r'^admin/', include(admin.site.urls)),
)
-:func:`~django.conf.urls.defaults.include` simply references another URLconf.
+:func:`~django.conf.urls.include` simply references another URLconf.
Note that the regular expression doesn't have a ``$`` (end-of-string match
character) but has the trailing slash. Whenever Django encounters
-:func:`~django.conf.urls.defaults.include`, it chops off whatever part of the
+:func:`~django.conf.urls.include`, it chops off whatever part of the
URL matched up to that point and sends the remaining string to the included
URLconf for further processing.
@@ -527,7 +527,7 @@ URLconf by removing the leading "polls/" from each line, and removing the
lines registering the admin site. Your ``polls/urls.py`` file should now look like
this::
- from django.conf.urls.defaults import patterns, include, url
+ from django.conf.urls import patterns, include, url
urlpatterns = patterns('polls.views',
(r'^$', 'index'),
@@ -536,7 +536,7 @@ this::
(r'^(?P<poll_id>\d+)/vote/$', 'vote'),
)
-The idea behind :func:`~django.conf.urls.defaults.include` and URLconf
+The idea behind :func:`~django.conf.urls.include` and URLconf
decoupling is to make it easy to plug-and-play URLs. Now that polls are in their
own URLconf, they can be placed under "/polls/", or under "/fun_polls/", or
under "/content/polls/", or any other path root, and the app will still work.
diff --git a/docs/intro/tutorial04.txt b/docs/intro/tutorial04.txt
index 86d4eef9b7..f0d2abc191 100644
--- a/docs/intro/tutorial04.txt
+++ b/docs/intro/tutorial04.txt
@@ -218,7 +218,7 @@ Read on for details.
First, open the ``polls/urls.py`` URLconf. It looks like this, according to the
tutorial so far::
- from django.conf.urls.defaults import patterns, include, url
+ from django.conf.urls import patterns, include, url
urlpatterns = patterns('polls.views',
(r'^$', 'index'),
@@ -229,7 +229,7 @@ tutorial so far::
Change it like so::
- from django.conf.urls.defaults import patterns, include, url
+ from django.conf.urls import patterns, include, url
from django.views.generic import DetailView, ListView
from polls.models import Poll
@@ -269,9 +269,9 @@ two views abstract the concepts of "display a list of objects" and
that we have a way to refer to its URL later on (see the
documentation about :ref:`naming URL patterns
<naming-url-patterns>` for information). We're also using the
- :func:`~django.conf.urls.default.url` function from
- :mod:`django.conf.urls.defaults` here. It's a good habit to use
- :func:`~django.conf.urls.defaults.url` when you are providing a
+ :func:`~django.conf.urls.url` function from
+ :mod:`django.conf.urls` here. It's a good habit to use
+ :func:`~django.conf.urls.url` when you are providing a
pattern name like this.
By default, the :class:`~django.views.generic.list.DetailView` generic