summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2011-09-20 18:30:06 +0000
committerRamiro Morales <cramm0@gmail.com>2011-09-20 18:30:06 +0000
commitaaf77c1676e44019abe544911ff7a06eb2690295 (patch)
treef73ab5be90d41006ee52ca8942cfb542ea662a0f /docs/ref
parent7b21bfc0745f92f83a6826a3d3e58797fb74e326 (diff)
Converted internal link generation in the admin and admin document generator to use named URLs.
Thanks to Florian Apolloner for both the initial patch and his final push to get this fixed, to Dario Ocles for his great work on the admin templates and switching the admin_doc application to also use named URLs, to Mikko Hellsing for his comments and to Jannis and Julien for their review and design guidance. Fixes #15294. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16857 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/contrib/admin/index.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index 2da6774d44..21145c5652 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -1960,3 +1960,18 @@ if you specifically wanted the admin view from the admin instance named
For more details, see the documentation on :ref:`reversing namespaced URLs
<topics-http-reversing-url-namespaces>`.
+
+To allow easier reversing of the admin urls in templates, Django provides an
+``admin_url`` filter which takes an action as argument:
+
+.. code-block:: html+django
+
+ {% load admin_urls %}
+ {% load url from future %}
+ <a href="{% url opts|admin_urlname:'add' %}">Add user</a>
+ <a href="{% url opts|admin_urlname:'delete' user.pk %}">Delete this user</a>
+
+The action in the examples above match the last part of the URL names for
+:class:`ModelAdmin` instances described above. The ``opts`` variable can be any
+object which has an ``app_label`` and ``module_name`` and is usually supplied
+by the admin views for the current model.