Django

Code

Changeset 8470

Show
Ignore:
Timestamp:
08/22/08 15:08:26 (3 months ago)
Author:
jacob
Message:

[djangoproject.com] Added new docs index views.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • djangoproject.com/djangodocs/templates/docs/doc.html

    r8454 r8470  
    5050          <li>Next: <a href="{{ doc.next.link }}">{{ doc.next.title }}</a></li> 
    5151        {% endif %} 
     52        <li><a href="{{ home }}contents/">Table of contents</a></li> 
    5253        {% for doc, title, accesskey, shorttitle in env.rellinks %} 
    5354          <li><a href="{{ home }}{{ doc }}/">{{ title }}</a></li> 
  • djangoproject.com/djangodocs/views.py

    r8452 r8470  
    3232 
    3333    # First look for <bits>/index.fpickle, then for <bits>.fpickle 
    34     bits = url.strip('/').split('/') 
    35     doc = docroot.child(*(bits+['index.fpickle'])
     34    bits = url.strip('/').split('/') + ['index.fpickle'] 
     35    doc = docroot.child(*bits
    3636    if not doc.exists(): 
    37         doc = docroot.child(*bits[:-1] + ["%s.fpickle" % bits[-1]]) 
     37        bits = bits[:-2] + ['%s.fpickle' % bits[-2]] 
     38        doc = docroot.child(*bits) 
    3839        if not doc.exists(): 
    3940            raise Http404("'%s' does not exist" % doc) 
    40      
    41     # Build up a list of templates to search for so that if the page is 
    42     # "ref/models", the list will be ["docs/ref/models.html", "docs/ref.html"] 
     41 
    4342    bits[-1] = bits[-1].replace('.fpickle', '') 
    44     templates = ["docs/%s.html" % "/".join(bits[:-i+1]) for i in range(len(bits))]     
    45     return render_to_response(templates + ['docs/doc.html'], { 
     43    template_names = [ 
     44        'docs/%s.html' % '-'.join([b for b in bits if b]),  
     45        'docs/doc.html' 
     46    ] 
     47    return render_to_response(template_names, { 
    4648        'doc': pickle.load(open(doc)), 
    4749        'env': pickle.load(open(docroot.child('globalcontext.pickle'))),