Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Fixes #14743 - Add sphinx links and other cleanups to topics/…

…http/urls.txt. Thanks adamv for the patch.

Backport of applicable portions of 14705 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14706 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 4b752d6490722568789470aec883224df1bc49b1 1 parent 1c68437
Tim Graham authored November 26, 2010

Showing 1 changed file with 19 additions and 15 deletions. Show diff stats Hide diff stats

  1. 34  docs/topics/http/urls.txt
34  docs/topics/http/urls.txt
@@ -37,14 +37,14 @@ When a user requests a page from your Django-powered site, this is the
37 37
 algorithm the system follows to determine which Python code to execute:
38 38
 
39 39
     1. Django determines the root URLconf module to use. Ordinarily,
40  
-       this is the value of the ``ROOT_URLCONF`` setting, but if the incoming
  40
+       this is the value of the :setting:`ROOT_URLCONF` setting, but if the incoming
41 41
        ``HttpRequest`` object has an attribute called ``urlconf`` (set by
42 42
        middleware :ref:`request processing <request-middleware>`), its value
43  
-       will be used in place of the ``ROOT_URLCONF`` setting.
  43
+       will be used in place of the :setting:`ROOT_URLCONF` setting.
44 44
 
45 45
     2. Django loads that Python module and looks for the variable
46 46
        ``urlpatterns``. This should be a Python list, in the format returned by
47  
-       the function ``django.conf.urls.defaults.patterns()``.
  47
+       the function :func:`django.conf.urls.defaults.patterns`.
48 48
 
49 49
     3. Django runs through each URL pattern, in order, and stops at the first
50 50
        one that matches the requested URL.
@@ -174,12 +174,14 @@ Syntax of the urlpatterns variable
174 174
 ==================================
175 175
 
176 176
 ``urlpatterns`` should be a Python list, in the format returned by the function
177  
-``django.conf.urls.defaults.patterns()``. Always use ``patterns()`` to create
  177
+:func:`django.conf.urls.defaults.patterns`. Always use ``patterns()`` to create
178 178
 the ``urlpatterns`` variable.
179 179
 
180 180
 Convention is to use ``from django.conf.urls.defaults import *`` at the top of
181 181
 your URLconf. This gives your module access to these objects:
182 182
 
  183
+.. module:: django.conf.urls.defaults
  184
+
183 185
 patterns
184 186
 --------
185 187
 
@@ -436,10 +438,11 @@ directly the pattern list as returned by `patterns`_ instead. For example::
436 438
 
437 439
 This approach can be seen in use when you deploy an instance of the Django
438 440
 Admin application. The Django Admin is deployed as instances of a
439  
-:class:`AdminSite`; each :class:`AdminSite` instance has an attribute
440  
-``urls`` that returns the url patterns available to that instance. It is this
441  
-attribute that you ``include()`` into your projects ``urlpatterns`` when you
442  
-deploy the admin instance.
  441
+:class:`~django.contrib.admin.AdminSite`; each
  442
+:class:`~django.contrib.admin.AdminSite` instance has an attribute ``urls``
  443
+that returns the url patterns available to that instance. It is this attribute
  444
+that you ``include()`` into your projects ``urlpatterns`` when you deploy the
  445
+admin instance.
443 446
 
444 447
 .. _`Django Web site`: http://www.djangoproject.com/
445 448
 
@@ -507,9 +510,9 @@ a 3-tuple containing::
507 510
 
508 511
 This will include the nominated URL patterns into the given application and
509 512
 instance namespace. For example, the ``urls`` attribute of Django's
510  
-:class:`AdminSite` object returns a 3-tuple that contains all the patterns in
511  
-an admin site, plus the name of the admin instance, and the application
512  
-namespace ``admin``.
  513
+:class:`~django.contrib.admin.AdminSite` object returns a 3-tuple that contains
  514
+all the patterns in an admin site, plus the name of the admin instance, and the
  515
+application namespace ``admin``.
513 516
 
514 517
 Once you have defined namespaced URLs, you can reverse them. For details on
515 518
 reversing namespaced urls, see the documentation on :ref:`reversing namespaced
@@ -830,15 +833,16 @@ URL paths to the corresponding view functions. It has the following signature:
830 833
 
831 834
 .. function:: resolve(path, urlconf=None)
832 835
 
833  
-``path`` is the URL path you want to resolve. As with ``reverse()`` above, you
834  
-don't need to worry about the ``urlconf`` parameter. The function returns the
835  
-triple (view function, arguments, keyword arguments).
  836
+``path`` is the URL path you want to resolve. As with
  837
+:func:`~django.core.urlresolvers.reverse`, you don't need to
  838
+worry about the ``urlconf`` parameter. The function returns
  839
+the triple (view function, arguments, keyword arguments).
836 840
 
837 841
 If the URL does not resolve, the function raises an
838 842
 :class:`~django.http.Http404` exception.
839 843
 
840 844
 For example, it can be used for testing if a view would raise a ``Http404``
841  
-error before redirecting to it::
  845
+error before redirecting to it:
842 846
 
843 847
     from urlparse import urlparse
844 848
     from django.core.urlresolvers import resolve

0 notes on commit 4b752d6

Please sign in to comment.
Something went wrong with that request. Please try again.