summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2012-10-07 20:11:12 -0300
committerRamiro Morales <cramm0@gmail.com>2012-10-07 20:21:07 -0300
commitec1aad1671bfbba7ef58e7477dd14d7add065838 (patch)
tree9b3ae0431e0da2d4450d8b669f69bdc7e3c37c9d /docs/ref
parent34a736b7521def321b2104d541e634134c5d1c62 (diff)
Added section about URL reversion to URL mapper document.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/contrib/formtools/form-wizard.txt2
-rw-r--r--docs/ref/models/instances.txt12
-rw-r--r--docs/ref/templates/builtins.txt2
-rw-r--r--docs/ref/urlresolvers.txt16
4 files changed, 18 insertions, 14 deletions
diff --git a/docs/ref/contrib/formtools/form-wizard.txt b/docs/ref/contrib/formtools/form-wizard.txt
index d5231de3e5..0ced1bf155 100644
--- a/docs/ref/contrib/formtools/form-wizard.txt
+++ b/docs/ref/contrib/formtools/form-wizard.txt
@@ -226,7 +226,7 @@ Hooking the wizard into a URLconf
---------------------------------
Finally, we need to specify which forms to use in the wizard, and then
-deploy the new :class:`WizardView` object at an URL in the ``urls.py``. The
+deploy the new :class:`WizardView` object at a URL in the ``urls.py``. The
wizard's :meth:`as_view` method takes a list of your
:class:`~django.forms.Form` classes as an argument during instantiation::
diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt
index 92fc4ef31a..1ba41148b0 100644
--- a/docs/ref/models/instances.txt
+++ b/docs/ref/models/instances.txt
@@ -494,12 +494,16 @@ defined. If it makes sense for your model's instances to each have a unique
URL, you should define ``get_absolute_url()``.
It's good practice to use ``get_absolute_url()`` in templates, instead of
-hard-coding your objects' URLs. For example, this template code is bad::
+hard-coding your objects' URLs. For example, this template code is bad:
+
+.. code-block:: html+django
<!-- BAD template code. Avoid! -->
<a href="/people/{{ object.id }}/">{{ object.name }}</a>
-This template code is much better::
+This template code is much better:
+
+.. code-block:: html+django
<a href="{{ object.get_absolute_url }}">{{ object.name }}</a>
@@ -535,7 +539,9 @@ pattern name) and a list of position or keyword arguments and uses the URLconf
patterns to construct the correct, full URL. It returns a string for the
correct URL, with all parameters substituted in the correct positions.
-The ``permalink`` decorator is a Python-level equivalent to the :ttag:`url` template tag and a high-level wrapper for the :func:`django.core.urlresolvers.reverse()` function.
+The ``permalink`` decorator is a Python-level equivalent to the :ttag:`url`
+template tag and a high-level wrapper for the
+:func:`django.core.urlresolvers.reverse()` function.
An example should make it clear how to use ``permalink()``. Suppose your URLconf
contains a line such as::
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
index 07ac284905..3b8d058fb4 100644
--- a/docs/ref/templates/builtins.txt
+++ b/docs/ref/templates/builtins.txt
@@ -997,7 +997,7 @@ refer to the name of the pattern in the ``url`` tag instead of using the
path to the view.
Note that if the URL you're reversing doesn't exist, you'll get an
-:exc:`^django.core.urlresolvers.NoReverseMatch` exception raised, which will
+:exc:`~django.core.urlresolvers.NoReverseMatch` exception raised, which will
cause your site to display an error page.
If you'd like to retrieve a URL without displaying it, you can use a slightly
diff --git a/docs/ref/urlresolvers.txt b/docs/ref/urlresolvers.txt
index 965cafb29b..1bb33c7ca1 100644
--- a/docs/ref/urlresolvers.txt
+++ b/docs/ref/urlresolvers.txt
@@ -8,8 +8,7 @@ reverse()
---------
If you need to use something similar to the :ttag:`url` template tag in
-your code, Django provides the following function (in the
-:mod:`django.core.urlresolvers` module):
+your code, Django provides the following function:
.. function:: reverse(viewname, [urlconf=None, args=None, kwargs=None, current_app=None])
@@ -59,15 +58,15 @@ You can use ``kwargs`` instead of ``args``. For example::
.. note::
- The string returned by :meth:`~django.core.urlresolvers.reverse` is already
+ The string returned by ``reverse()`` is already
:ref:`urlquoted <uri-and-iri-handling>`. For example::
>>> reverse('cities', args=[u'Orléans'])
'.../Orl%C3%A9ans/'
Applying further encoding (such as :meth:`~django.utils.http.urlquote` or
- ``urllib.quote``) to the output of :meth:`~django.core.urlresolvers.reverse`
- may produce undesirable results.
+ ``urllib.quote``) to the output of ``reverse()`` may produce undesirable
+ results.
reverse_lazy()
--------------
@@ -94,9 +93,8 @@ URLConf is loaded. Some common cases where this function is necessary are:
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:
+The ``resolve()`` function can be used for resolving URL paths to the
+corresponding view functions. It has the following signature:
.. function:: resolve(path, urlconf=None)
@@ -184,7 +182,7 @@ whether a view would raise a ``Http404`` error before redirecting to it::
permalink()
-----------
-The :func:`django.db.models.permalink` decorator is useful for writing short
+The :func:`~django.db.models.permalink` decorator is useful for writing short
methods that return a full URL path. For example, a model's
``get_absolute_url()`` method. See :func:`django.db.models.permalink` for more.