Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[djangoproject.com] Added new docs index views.

git-svn-id: http://code.djangoproject.com/svn/djangoproject.com@8470 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e8d26f88907558a0d06f1554fd23e9f0eccee0c1 1 parent f7fe261
jacob authored
View
1  djangodocs/templates/docs/doc.html
@@ -49,6 +49,7 @@ <h2 id="comments">Questions/Feedback</h2>
{% if doc.next %}
<li>Next: <a href="{{ doc.next.link }}">{{ doc.next.title }}</a></li>
{% endif %}
+ <li><a href="{{ home }}contents/">Table of contents</a></li>
{% for doc, title, accesskey, shorttitle in env.rellinks %}
<li><a href="{{ home }}{{ doc }}/">{{ title }}</a></li>
{% endfor %}
View
31 djangodocs/templates/docs/index.html
@@ -0,0 +1,31 @@
+{% extends "docs/doc.html" %}
+
+{% block extrahead %}
+ {{ block.super }}
+ <style type="text/css" media="screen">
+
+ p.rubric { font-size:150%; font-weight:normal; margin-bottom:.2em; color:#487858; }
+ div.section dt { font-weight: normal; }
+
+ #s-getting-help { float: right; width: 40%; background: #E1ECE2; padding: 1em; margin: 2em 0 2em 2em; }
+ #s-getting-help h2 { margin: 0; }
+
+ #s-django-documentation div.section div.section h3 { margin: 0; }
+ #s-django-documentation div.section div.section { background: #E1ECE2; padding: 1em; margin: 2em 0 2em 57%; }
+ #s-django-documentation div.section div.section a.reference { white-space: nowrap; }
+
+ #s-using-django dl,
+ #s-add-on-contrib-applications dl,
+ #s-solving-specific-problems dl,
+ #s-reference dl
+ { float: left; width: 57%; }
+
+ #s-add-on-contrib-applications,
+ #s-solving-specific-problems,
+ #s-reference,
+ #s-and-all-the-rest
+ { clear: left; }
+ </style>
+{% endblock %}
+
+{% block toc-wrapper %}{% endblock %}
View
18 djangodocs/views.py
@@ -31,18 +31,20 @@ def document(request, lang, version, url):
docroot = Path(settings.DOCS_PICKLE_ROOT)
# First look for <bits>/index.fpickle, then for <bits>.fpickle
- bits = url.strip('/').split('/')
- doc = docroot.child(*(bits+['index.fpickle']))
+ bits = url.strip('/').split('/') + ['index.fpickle']
+ doc = docroot.child(*bits)
if not doc.exists():
- doc = docroot.child(*bits[:-1] + ["%s.fpickle" % bits[-1]])
+ bits = bits[:-2] + ['%s.fpickle' % bits[-2]]
+ doc = docroot.child(*bits)
if not doc.exists():
raise Http404("'%s' does not exist" % doc)
-
- # Build up a list of templates to search for so that if the page is
- # "ref/models", the list will be ["docs/ref/models.html", "docs/ref.html"]
+
bits[-1] = bits[-1].replace('.fpickle', '')
- templates = ["docs/%s.html" % "/".join(bits[:-i+1]) for i in range(len(bits))]
- return render_to_response(templates + ['docs/doc.html'], {
+ template_names = [
+ 'docs/%s.html' % '-'.join([b for b in bits if b]),
+ 'docs/doc.html'
+ ]
+ return render_to_response(template_names, {
'doc': pickle.load(open(doc)),
'env': pickle.load(open(docroot.child('globalcontext.pickle'))),
'update_date': datetime.datetime.fromtimestamp(docroot.child('last_build').mtime()),
Please sign in to comment.
Something went wrong with that request. Please try again.