Code

Ticket #7810: named-urls-admindocs-7810.diff

File named-urls-admindocs-7810.diff, 2.8 KB (added by MattBowen, 6 years ago)

adds names for the admindocs urls and uses the named URL in admin's base.html

Line 
1Index: django/contrib/admin/templates/admin/base.html
2===================================================================
3--- django/contrib/admin/templates/admin/base.html      (revision 8168)
4+++ django/contrib/admin/templates/admin/base.html      (working copy)
5@@ -22,7 +22,7 @@
6         {% block branding %}{% endblock %}
7         </div>
8         {% if user.is_authenticated and user.is_staff %}
9-        <div id="user-tools">{% trans 'Welcome,' %} <strong>{% if user.first_name %}{{ user.first_name|escape }}{% else %}{{ user.username }}{% endif %}</strong>. {% block userlinks %}<a href="{{ root_path }}doc/">{% trans 'Documentation' %}</a> / <a href="{{ root_path }}password_change/">{% trans 'Change password' %}</a> / <a href="{{ root_path }}logout/">{% trans 'Log out' %}</a>{% endblock %}</div>
10+        <div id="user-tools">{% trans 'Welcome,' %} <strong>{% if user.first_name %}{{ user.first_name|escape }}{% else %}{{ user.username }}{% endif %}</strong>. {% block userlinks %}<a href="{% url django-admindocs-docroot %}">{% trans 'Documentation' %}</a> / <a href="{{ root_path }}password_change/">{% trans 'Change password' %}</a> / <a href="{{ root_path }}logout/">{% trans 'Log out' %}</a>{% endblock %}</div>
11         {% endif %}
12         {% block nav-global %}{% endblock %}
13     </div>
14Index: django/contrib/admindocs/urls.py
15===================================================================
16--- django/contrib/admindocs/urls.py    (revision 8168)
17+++ django/contrib/admindocs/urls.py    (working copy)
18@@ -2,14 +2,14 @@
19 from django.contrib.admindocs import views
20 
21 urlpatterns = patterns('',
22-    ('^$', views.doc_index),
23-    ('^bookmarklets/$', views.bookmarklets),
24-    ('^tags/$', views.template_tag_index),
25-    ('^filters/$', views.template_filter_index),
26-    ('^views/$', views.view_index),
27-    ('^views/(?P<view>[^/]+)/$', views.view_detail),
28-    ('^models/$', views.model_index),
29-    ('^models/(?P<app_label>[^\.]+)\.(?P<model_name>[^/]+)/$', views.model_detail),
30+    url('^$', views.doc_index, name='django-admindocs-docroot'),
31+    url('^bookmarklets/$', views.bookmarklets, name='django-admindocs-bookmarklets'),
32+    url('^tags/$', views.template_tag_index, name='django-admindocs-tags'),
33+    url('^filters/$', views.template_filter_index, name='django-admindocs-filters'),
34+    url('^views/$', views.view_index, name='django-admindocs-views-index'),
35+    url('^views/(?P<view>[^/]+)/$', views.view_detail, name='django-admindocs-views-detail'),
36+    url('^models/$', views.model_index, name='django-admindocs-models-index'),
37+    url('^models/(?P<app_label>[^\.]+)\.(?P<model_name>[^/]+)/$', views.model_detail, name='django-admindocs-models-detail'),
38 #    ('^templates/$', views.template_index),
39-    ('^templates/(?P<template>.*)/$', views.template_detail),
40+    url('^templates/(?P<template>.*)/$', views.template_detail, name='django-admindocs-templates'),
41 )