From 0871ff2c9c0745b203776467b9d6319adb7214fd Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss <jacob@jacobian.org> Date: Fri, 29 Aug 2008 19:28:53 +0000 Subject: [PATCH] Fixed #7810: added named URLs for admin docs, and use them in the admin base template. Thanks, MattBowen. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8717 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- .../contrib/admin/templates/admin/base.html | 2 +- django/contrib/admindocs/urls.py | 46 +++++++++++++++---- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/django/contrib/admin/templates/admin/base.html b/django/contrib/admin/templates/admin/base.html index 479e18b2ee..f99e6d88b6 100644 --- a/django/contrib/admin/templates/admin/base.html +++ b/django/contrib/admin/templates/admin/base.html @@ -22,7 +22,7 @@ {% block branding %}{% endblock %} </div> {% if user.is_authenticated and user.is_staff %} - <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> + <div id="user-tools">{% trans 'Welcome,' %} <strong>{% if user.first_name %}{{ user.first_name|escape }}{% else %}{{ user.username }}{% endif %}</strong>. {% block userlinks %}{% url django-admindocs-docroot as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / {% endif %}<a href="{{ root_path }}password_change/">{% trans 'Change password' %}</a> / <a href="{{ root_path }}logout/">{% trans 'Log out' %}</a>{% endblock %}</div> {% endif %} {% block nav-global %}{% endblock %} </div> diff --git a/django/contrib/admindocs/urls.py b/django/contrib/admindocs/urls.py index e7baa76fc0..57edb5697b 100644 --- a/django/contrib/admindocs/urls.py +++ b/django/contrib/admindocs/urls.py @@ -2,14 +2,40 @@ from django.conf.urls.defaults import * from django.contrib.admindocs import views urlpatterns = patterns('', - ('^$', views.doc_index), - ('^bookmarklets/$', views.bookmarklets), - ('^tags/$', views.template_tag_index), - ('^filters/$', views.template_filter_index), - ('^views/$', views.view_index), - ('^views/(?P<view>[^/]+)/$', views.view_detail), - ('^models/$', views.model_index), - ('^models/(?P<app_label>[^\.]+)\.(?P<model_name>[^/]+)/$', views.model_detail), -# ('^templates/$', views.template_index), - ('^templates/(?P<template>.*)/$', views.template_detail), + url('^$', + views.doc_index, + name='django-admindocs-docroot' + ), + url('^bookmarklets/$', + views.bookmarklets, + name='django-admindocs-bookmarklets' + ), + url('^tags/$', + views.template_tag_index, + name='django-admindocs-tags' + ), + url('^filters/$', + views.template_filter_index, + name='django-admindocs-filters' + ), + url('^views/$', + views.view_index, + name='django-admindocs-views-index' + ), + url('^views/(?P<view>[^/]+)/$', + views.view_detail, + name='django-admindocs-views-detail' + ), + url('^models/$', + views.model_index, + name='django-admindocs-models-index' + ), + url('^models/(?P<app_label>[^\.]+)\.(?P<model_name>[^/]+)/$', + views.model_detail, + name='django-admindocs-models-detail' + ), + url('^templates/(?P<template>.*)/$', + views.template_detail, + name='django-admindocs-templates' + ), )