mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #18974 - Warned against using models.permalink
Thanks dstufft for the draft patch.
This commit is contained in:
@@ -262,11 +262,11 @@ Taking care in ``get_absolute_url()``
|
||||
|
||||
URLs can only contain ASCII characters. If you're constructing a URL from
|
||||
pieces of data that might be non-ASCII, be careful to encode the results in a
|
||||
way that is suitable for a URL. The ``django.db.models.permalink()`` decorator
|
||||
handles this for you automatically.
|
||||
way that is suitable for a URL. The :func:`~django.core.urlresolvers.reverse`
|
||||
function handles this for you automatically.
|
||||
|
||||
If you're constructing a URL manually (i.e., *not* using the ``permalink()``
|
||||
decorator), you'll need to take care of the encoding yourself. In this case,
|
||||
If you're constructing a URL manually (i.e., *not* using the ``reverse()``
|
||||
function), you'll need to take care of the encoding yourself. In this case,
|
||||
use the ``iri_to_uri()`` and ``urlquote()`` functions that were documented
|
||||
above_. For example::
|
||||
|
||||
|
||||
Reference in New Issue
Block a user