|
@@ -772,9 +772,9 @@ reverse()
|
|
|
|
|
|
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):
|
|
|
+:mod:`django.core.urlresolvers` module):
|
|
|
|
|
|
-.. function:: reverse(viewname, urlconf=None, args=None, kwargs=None, current_app=None)
|
|
|
+.. function:: reverse(viewname, [urlconf=None, args=None, kwargs=None, current_app=None])
|
|
|
|
|
|
``viewname`` is either the function name (either a function reference, or the
|
|
|
string version of the name, if you used that form in ``urlpatterns``) or the
|
|
@@ -815,6 +815,18 @@ namespaces into URLs on specific application instances, according to the
|
|
|
be imported correctly. Do not include lines that reference views you
|
|
|
haven't written yet, because those views will not be importable.
|
|
|
|
|
|
+.. note::
|
|
|
+
|
|
|
+ The string returned by :meth:`~django.core.urlresolvers.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 ouput of :meth:`~django.core.urlresolvers.reverse`
|
|
|
+ may produce undesirable results.
|
|
|
+
|
|
|
resolve()
|
|
|
---------
|
|
|
|