Commits

Anonymous committed 20d1e68

newforms-admin: Fixed #7466 -- Generate a root_path for admindocs views so the userlinks are properly linked. Thanks handelaar for the report.

  • Participants
  • Parent commits aee3d61
  • Branches newforms-admin

Comments (0)

Files changed (9)

django/contrib/admin/templates/admin_doc/bookmarklets.html

 {% extends "admin/base_site.html" %}
 
 {% block breadcrumbs %}{% load i18n %}<div class="breadcrumbs"><a href="../../">{% trans "Home" %}</a> &rsaquo; <a href="../">{% trans "Documentation" %}</a> &rsaquo; {% trans "Bookmarklets" %}</div>{% endblock %}
-{% block userlinks %}<a href="../../password_change/">{% trans 'Change password' %}</a> / <a href="../../logout/">{% trans 'Log out' %}</a>{% endblock %}
 {% block title %}{% trans "Documentation bookmarklets" %}{% endblock %}
 
 {% block content %}

django/contrib/admin/templates/admin_doc/missing_docutils.html

 {% extends "admin/base_site.html" %}
 {% load i18n %}
 {% block breadcrumbs %}<div class="breadcrumbs"><a href="../">Home</a> &rsaquo; Documentation</div>{% endblock %}
-{% block userlinks %}<a href="../password_change/">{% trans 'Change password' %}</a> / <a href="../logout/">{% trans 'Log out' %}</a>{% endblock %}
 {% block title %}Please install docutils{% endblock %}
 
 {% block content %}

django/contrib/admin/templates/admin_doc/model_detail.html

 {% extends "admin/base_site.html" %}
 {% load i18n %}
-{% block userlinks %}<a href="../../../password_change/">{% trans 'Change password' %}</a> / <a href="../../../logout/">{% trans 'Log out' %}</a>{% endblock %}
 {% block extrahead %}
 {{ block.super }}
 <style type="text/css">

django/contrib/admin/templates/admin_doc/model_index.html

 {% load i18n %}
 {% block coltype %}colSM{% endblock %}
 {% block breadcrumbs %}<div class="breadcrumbs"><a href="../../">Home</a> &rsaquo; <a href="../">Documentation</a> &rsaquo; Models</div>{% endblock %}
-{% block userlinks %}<a href="../../password_change/">{% trans 'Change password' %}</a> / <a href="../../logout/">{% trans 'Log out' %}</a>{% endblock %}
 
 {% block title %}Models{% endblock %}
 

django/contrib/admin/templates/admin_doc/template_detail.html

 {% extends "admin/base_site.html" %}
 {% load i18n %}
 {% block breadcrumbs %}<div class="breadcrumbs"><a href="../../../">Home</a> &rsaquo; <a href="../../">Documentation</a> &rsaquo; Templates &rsaquo; {{ name|escape }}</div>{% endblock %}
-{% block userlinks %}<a href="../../../password_change/">{% trans 'Change password' %}</a> / <a href="../../../logout/">{% trans 'Log out' %}</a>{% endblock %}
 
 {% block title %}Template: {{ name|escape }}{% endblock %}
 

django/contrib/admin/templates/admin_doc/template_filter_index.html

 {% load i18n %}
 {% block coltype %}colSM{% endblock %}
 {% block breadcrumbs %}<div class="breadcrumbs"><a href="../../">Home</a> &rsaquo; <a href="../">Documentation</a> &rsaquo; filters</div>{% endblock %}
-{% block userlinks %}<a href="../../password_change/">{% trans 'Change password' %}</a> / <a href="../../logout/">{% trans 'Log out' %}</a>{% endblock %}
 {% block title %}Template filters{% endblock %}
 
 {% block content %}

django/contrib/admin/templates/admin_doc/template_tag_index.html

 {% load i18n %}
 {% block coltype %}colSM{% endblock %}
 {% block breadcrumbs %}<div class="breadcrumbs"><a href="../../">Home</a> &rsaquo; <a href="../">Documentation</a> &rsaquo; Tags</div>{% endblock %}
-{% block userlinks %}<a href="../../password_change/">{% trans 'Change password' %}</a> / <a href="../../logout/">{% trans 'Log out' %}</a>{% endblock %}
 {% block title %}Template tags{% endblock %}
 
 {% block content %}

django/contrib/admin/templates/admin_doc/view_detail.html

 {% extends "admin/base_site.html" %}
 {% load i18n %}
 {% block breadcrumbs %}<div class="breadcrumbs"><a href="../../../">Home</a> &rsaquo; <a href="../../">Documentation</a> &rsaquo; <a href="../">Views</a> &rsaquo; {{ name }}</div>{% endblock %}
-{% block userlinks %}<a href="../../../password_change/">{% trans 'Change password' %}</a> / <a href="../../../logout/">{% trans 'Log out' %}</a>{% endblock %}
 {% block title %}View: {{ name }}{% endblock %}
 
 {% block content %}

django/contrib/admindocs/views.py

 def doc_index(request):
     if not utils.docutils_is_available:
         return missing_docutils_page(request)
-    return render_to_response('admin_doc/index.html', context_instance=RequestContext(request))
+    root_path = re.sub(re.escape('doc/') + '$', '', request.path)
+    return render_to_response('admin_doc/index.html', {
+        'root_path': root_path,
+    }, context_instance=RequestContext(request))
 doc_index = staff_member_required(doc_index)
 
 def bookmarklets(request):
     # Hack! This couples this view to the URL it lives at.
     admin_root = request.path[:-len('doc/bookmarklets/')]
+    root_path = re.sub(re.escape('doc/bookmarklets/') + '$', '', request.path)
     return render_to_response('admin_doc/bookmarklets.html', {
+        'root_path': root_path,
         'admin_url': mark_safe("%s://%s%s" % (request.is_secure() and 'https' or 'http', request.get_host(), admin_root)),
     }, context_instance=RequestContext(request))
 bookmarklets = staff_member_required(bookmarklets)
                 'meta': metadata,
                 'library': tag_library,
             })
-
-    return render_to_response('admin_doc/template_tag_index.html', {'tags': tags}, context_instance=RequestContext(request))
+    root_path = re.sub(re.escape('doc/tags/') + '$', '', request.path)
+    return render_to_response('admin_doc/template_tag_index.html', {
+        'root_path': root_path,
+        'tags': tags
+    }, context_instance=RequestContext(request))
 template_tag_index = staff_member_required(template_tag_index)
 
 def template_filter_index(request):
                 'meta': metadata,
                 'library': tag_library,
             })
-    return render_to_response('admin_doc/template_filter_index.html', {'filters': filters}, context_instance=RequestContext(request))
+    root_path = re.sub(re.escape('doc/filters/') + '$', '', request.path)
+    return render_to_response('admin_doc/template_filter_index.html', {
+        'root_path': root_path,
+        'filters': filters
+    }, context_instance=RequestContext(request))
 template_filter_index = staff_member_required(template_filter_index)
 
 def view_index(request):
                 'site': site_obj,
                 'url': simplify_regex(regex),
             })
-    return render_to_response('admin_doc/view_index.html', {'views': views}, context_instance=RequestContext(request))
+    root_path = re.sub(re.escape('doc/views/') + '$', '', request.path)
+    return render_to_response('admin_doc/view_index.html', {
+        'root_path': root_path,
+        'views': views
+    }, context_instance=RequestContext(request))
 view_index = staff_member_required(view_index)
 
 def view_detail(request, view):
         body = utils.parse_rst(body, 'view', _('view:') + view)
     for key in metadata:
         metadata[key] = utils.parse_rst(metadata[key], 'model', _('view:') + view)
+    root_path = re.sub(re.escape('doc/views/%s/' % view) + '$', '', request.path)
     return render_to_response('admin_doc/view_detail.html', {
+        'root_path': root_path,
         'name': view,
         'summary': title,
         'body': body,
 def model_index(request):
     if not utils.docutils_is_available:
         return missing_docutils_page(request)
-
     m_list = [m._meta for m in models.get_models()]
-    return render_to_response('admin_doc/model_index.html', {'models': m_list}, context_instance=RequestContext(request))
+    root_path = re.sub(re.escape('doc/models/') + '$', '', request.path)
+    return render_to_response('admin_doc/model_index.html', {
+        'root_path': root_path,
+        'models': m_list
+    }, context_instance=RequestContext(request))
 model_index = staff_member_required(model_index)
 
 def model_detail(request, app_label, model_name):
     if not utils.docutils_is_available:
         return missing_docutils_page(request)
-
+        
     # Get the model class.
     try:
         app_mod = models.get_app(app_label)
             'data_type' : 'Integer',
             'verbose'   : utils.parse_rst(_("number of %s") % verbose , 'model', _('model:') + opts.module_name),
         })
-
+    root_path = re.sub(re.escape('doc/models/%s.%s/' % (app_label, model_name)) + '$', '', request.path)
     return render_to_response('admin_doc/model_detail.html', {
+        'root_path': root_path,
         'name': '%s.%s' % (opts.app_label, opts.object_name),
         'summary': _("Fields on %s objects") % opts.object_name,
         'description': model.__doc__,
                 'site': site_obj,
                 'order': list(settings_mod.TEMPLATE_DIRS).index(dir),
             })
+    root_path = re.sub(re.escape('doc/templates/%s/' % template) + '$', '', request.path)
     return render_to_response('admin_doc/template_detail.html', {
+        'root_path': root_path,
         'name': template,
         'templates': templates,
     }, context_instance=RequestContext(request))