mirror of
https://github.com/django/django.git
synced 2025-07-04 01:39:20 +00:00
newforms-admin: Fixed #7466 -- Generate a root_path for admindocs views 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
This commit is contained in:
parent
885ade7784
commit
584c41aff7
@ -1,7 +1,6 @@
|
||||
{% extends "admin/base_site.html" %}
|
||||
|
||||
{% block breadcrumbs %}{% load i18n %}<div class="breadcrumbs"><a href="../../">{% trans "Home" %}</a> › <a href="../">{% trans "Documentation" %}</a> › {% 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 %}
|
||||
|
@ -1,7 +1,6 @@
|
||||
{% extends "admin/base_site.html" %}
|
||||
{% load i18n %}
|
||||
{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">Home</a> › 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 %}
|
||||
|
@ -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">
|
||||
|
@ -2,7 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block coltype %}colSM{% endblock %}
|
||||
{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../">Home</a> › <a href="../">Documentation</a> › 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 %}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
{% extends "admin/base_site.html" %}
|
||||
{% load i18n %}
|
||||
{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../../">Home</a> › <a href="../../">Documentation</a> › Templates › {{ 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 %}
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block coltype %}colSM{% endblock %}
|
||||
{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../">Home</a> › <a href="../">Documentation</a> › 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 %}
|
||||
|
@ -2,7 +2,6 @@
|
||||
{% load i18n %}
|
||||
{% block coltype %}colSM{% endblock %}
|
||||
{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../">Home</a> › <a href="../">Documentation</a> › 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 %}
|
||||
|
@ -1,7 +1,6 @@
|
||||
{% extends "admin/base_site.html" %}
|
||||
{% load i18n %}
|
||||
{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../../">Home</a> › <a href="../../">Documentation</a> › <a href="../">Views</a> › {{ 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 %}
|
||||
|
@ -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,9 +168,12 @@ view_detail = staff_member_required(view_detail)
|
||||
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):
|
||||
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user