[1.5.X] Fixed #18974 - Warned against using models.permalink

Thanks dstufft for the draft patch.

Backport of 0e3690d230 from master
This commit is contained in:
Tim Graham 2012-11-20 07:15:16 -05:00
parent b9f9bc9a17
commit 42fa51c002
5 changed files with 43 additions and 40 deletions

View file

@ -552,12 +552,11 @@ layers where URLs are needed:
* In templates: Using the :ttag:`url` template tag.
* In Python code: Using the :func:`django.core.urlresolvers.reverse()`
* In Python code: Using the :func:`django.core.urlresolvers.reverse`
function.
* In higher level code related to handling of URLs of Django model instances:
The :meth:`django.db.models.Model.get_absolute_url()` method and the
:func:`django.db.models.permalink` decorator.
The :meth:`~django.db.models.Model.get_absolute_url` method.
Examples
--------
@ -622,10 +621,10 @@ view::
)
This is completely valid, but it leads to problems when you try to do reverse
URL matching (through the :func:`~django.db.models.permalink` decorator or the
:ttag:`url` template tag). Continuing this example, if you wanted to retrieve
the URL for the ``archive`` view, Django's reverse URL matcher would get
confused, because *two* URL patterns point at that view.
URL matching (through the :func:`~django.core.urlresolvers.reverse` function
or the :ttag:`url` template tag). Continuing this example, if you wanted to
retrieve the URL for the ``archive`` view, Django's reverse URL matcher would
get confused, because *two* URL patterns point at that view.
To solve this problem, Django supports **named URL patterns**. That is, you can
give a name to a URL pattern in order to distinguish it from other patterns
@ -724,7 +723,7 @@ the fully qualified name into parts, and then tries the following lookup:
render a template.
The current application can also be specified manually as an argument
to the :func:`django.core.urlresolvers.reverse()` function.
to the :func:`django.core.urlresolvers.reverse` function.
3. If there is no current application. Django looks for a default
application instance. The default application instance is the instance