1
0
mirror of https://github.com/django/django.git synced 2025-07-18 08:39:15 +00:00

[1.0.X] Fixed #11492 -- Corrected some typos, and added some extra markup for the URLs documentation. Thanks to Ramiro Morales for the patch.

Merge of r11258 from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@11259 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2009-07-17 01:01:50 +00:00
parent 393e06997d
commit 29b53b2b1c

View File

@ -4,6 +4,8 @@
URL dispatcher
==============
.. module:: django.core.urlresolvers
A clean, elegant URL scheme is an important detail in a high-quality Web
application. Django lets you design URLs however you want, with no framework
limitations.
@ -182,11 +184,13 @@ your URLconf. This gives your module access to these objects:
patterns
--------
.. function:: patterns(prefix, pattern_description, ...)
A function that takes a prefix, and an arbitrary number of URL patterns, and
returns a list of URL patterns in the format Django needs.
The first argument to ``patterns()`` is a string ``prefix``. See
"The view prefix" below.
`The view prefix`_ below.
The remaining arguments should be tuples in this format::
@ -222,6 +226,8 @@ url
.. versionadded:: 1.0
.. function:: url(regex, view, kwargs=None, name=None, prefix='')
You can use the ``url()`` function, instead of a tuple, as an argument to
``patterns()``. This is convenient if you want to specify a name without the
optional extra arguments dictionary. For example::
@ -244,6 +250,8 @@ The ``prefix`` parameter has the same meaning as the first argument to
handler404
----------
.. data:: handler404
A string representing the full Python import path to the view that should be
called if none of the URL patterns match.
@ -253,6 +261,8 @@ value should suffice.
handler500
----------
.. data:: handler500
A string representing the full Python import path to the view that should be
called in case of server errors. Server errors happen when you have runtime
errors in view code.
@ -263,6 +273,8 @@ value should suffice.
include
-------
.. function:: include(<module or pattern_list>)
A function that takes a full Python import path to another URLconf that should
be "included" in this place. See `Including other URLconfs`_ below.
@ -597,7 +609,6 @@ If you need to use something similar to the :ttag:`url` template tag in
your code, Django provides the following method (in the
``django.core.urlresolvers`` module):
.. currentmodule:: django.core.urlresolvers
.. function:: reverse(viewname, urlconf=None, args=None, kwargs=None)
``viewname`` is either the function name (either a function reference, or the
@ -639,7 +650,6 @@ resolve()
The :func:`django.core.urlresolvers.resolve` function can be used for resolving
URL paths to the corresponding view functions. It has the following signature:
.. currentmodule:: django.core.urlresolvers
.. function:: resolve(path, urlconf=None)
``path`` is the URL path you want to resolve. As with ``reverse()`` above, you