mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #18974 - Warned against using models.permalink
Thanks dstufft for the draft patch.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user