Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

newforms-admin: Fixed #7466 -- Generate a root_path for admindocs vie…

…ws so the userlinks are properly linked. Thanks handelaar for the report.

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7934 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 584c41aff77bdee0d2e20c6741b7698d3be524f5 1 parent 885ade7
@brosner brosner authored
View
1  django/contrib/admin/templates/admin_doc/bookmarklets.html
@@ -1,7 +1,6 @@
{% 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 %}
View
1  django/contrib/admin/templates/admin_doc/missing_docutils.html
@@ -1,7 +1,6 @@
{% 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 %}
View
1  django/contrib/admin/templates/admin_doc/model_detail.html
@@ -1,6 +1,5 @@
{% 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">
View
1  django/contrib/admin/templates/admin_doc/model_index.html
@@ -2,7 +2,6 @@
{% 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 %}
View
1  django/contrib/admin/templates/admin_doc/template_detail.html
@@ -1,7 +1,6 @@
{% 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 %}
View
1  django/contrib/admin/templates/admin_doc/template_filter_index.html
@@ -2,7 +2,6 @@
{% 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 %}
View
1  django/contrib/admin/templates/admin_doc/template_tag_index.html
@@ -2,7 +2,6 @@
{% 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 %}
View
1  django/contrib/admin/templates/admin_doc/view_detail.html
@@ -1,7 +1,6 @@
{% 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 %}
View
42 django/contrib/admindocs/views.py
@@ -23,13 +23,18 @@ class GenericSite(object):
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)
@@ -61,8 +66,11 @@ def template_tag_index(request):
'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):
@@ -92,7 +100,11 @@ 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):
@@ -120,7 +132,11 @@ 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):
@@ -139,7 +155,9 @@ 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,
@@ -150,15 +168,18 @@ def view_detail(request, view):
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)
@@ -225,8 +246,9 @@ def model_detail(request, app_label, model_name):
'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__,
@@ -252,7 +274,9 @@ def template_detail(request, template):
'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))

0 comments on commit 584c41a

Please sign in to comment.
Something went wrong with that request. Please try again.