Changeset 8844
- Timestamp:
- 09/01/08 23:09:40 (4 months ago)
- Files:
-
- djangoproject.com/djangodocs/forms.py (added)
- djangoproject.com/djangodocs/settings.py (modified) (1 diff)
- djangoproject.com/djangodocs/templates/docs/doc.html (modified) (3 diffs)
- djangoproject.com/djangodocs/templates/docs/search_form.html (added)
- djangoproject.com/djangodocs/templates/docs/search.html (added)
- djangoproject.com/djangodocs/templatetags (added)
- djangoproject.com/djangodocs/templatetags/docs.py (added)
- djangoproject.com/djangodocs/templatetags/__init__.py (added)
- djangoproject.com/djangodocs/urls.py (modified) (2 diffs)
- djangoproject.com/djangodocs/views.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
djangoproject.com/djangodocs/settings.py
r8468 r8844 2 2 3 3 PREPEND_WWW = False 4 INSTALLED_APPS = [ ]4 INSTALLED_APPS = ['djangodocs'] 5 5 TEMPLATE_DIRS = [os.path.join(os.path.dirname(__file__), "templates")] + TEMPLATE_DIRS 6 TEMPLATE_CONTEXT_PROCESSORS = ['django.core.context_processors.request'] 6 7 ROOT_URLCONF = 'djangodocs.urls' 7 8 CACHE_MIDDLEWARE_KEY_PREFIX = 'djangodocs' djangoproject.com/djangodocs/templates/docs/doc.html
r8470 r8844 5 5 {% block extrahead %} 6 6 {{ block.super }} 7 <style type="text/css" media="screen"> 8 #docs-search { 9 color: #000; 10 float: right; 11 } 12 #docs-search form { 13 font-size: 92%; 14 margin: 0; 15 padding: 1em 1em 0; 16 white-space: nowrap; 17 } 18 form.search ul { 19 list-style: none; 20 margin: 0; 21 padding: 0; 22 } 23 form.search li { 24 display: inline; 25 padding-right: 1em; 26 } 27 form.search .query { 28 width: 18em; 29 } 30 </style> 7 31 <link rel="stylesheet" href="http://media.djangoproject.com/css/pygments.css" type="text/css" /> 8 32 {% endblock %} 9 33 10 {% block billboard %}<h2><a href="{{ home }}">Django documentation</a></h2>{% endblock %} 34 {% block billboard %} 35 <h2><a href="{{ home }}">Django documentation</a></h2> 36 {% endblock %} 11 37 12 38 {% block content %} … … 38 64 {{ doc.toc }} 39 65 {% endblock %} 66 {% endblock %} 67 68 {% block search %} 69 <h2>Search</h2> 70 {% load docs %} 71 {% search_form %} 40 72 {% endblock %} 41 73 … … 74 106 {% endblock %} 75 107 76 <h3>Last update:</h3> 77 <div>{{ update_date|date:"F j, Y, P" }} (<a href="http://www.timeanddate.com/worldclock/city.html?n=64">CDT</a>)</div> 108 {% block last-update-wrapper %} 109 <h3>Last update:</h3> 110 <div>{{ update_date|date:"F j, Y, P" }} (<a href="http://www.timeanddate.com/worldclock/city.html?n=64">CDT</a>)</div> 111 {% endblock %} 78 112 {% endblock %} djangoproject.com/djangodocs/urls.py
r8624 r8844 12 12 ), 13 13 url( 14 r'^(?P<lang>[a-z-]+)/(?P<version>[\w.-]+)/ (?P<url>[\w./-]*)$',15 djangodocs.views. document,14 r'^(?P<lang>[a-z-]+)/(?P<version>[\w.-]+)/search/$', 15 djangodocs.views.search, 16 16 ), 17 17 url( … … 23 23 djangodocs.views.source, 24 24 ), 25 url( 26 r'^(?P<lang>[a-z-]+)/(?P<version>[\w.-]+)/(?P<url>[\w./-]*)$', 27 djangodocs.views.document, 28 ), 25 29 ) djangoproject.com/djangodocs/views.py
r8470 r8844 6 6 from django.http import HttpResponseRedirect, Http404 7 7 from django.shortcuts import render_to_response 8 from django.template import RequestContext 8 9 from unipath import FSPath as Path 9 10 … … 27 28 28 29 def document(request, lang, version, url): 29 if lang != 'en' or version != 'dev' or url == "search/": raise Http404()30 if lang != 'en' or version != 'dev': raise Http404() 30 31 31 32 docroot = Path(settings.DOCS_PICKLE_ROOT) … … 45 46 'docs/doc.html' 46 47 ] 47 return render_to_response(template_names, {48 'doc': pickle.load(open(doc )),49 'env': pickle.load(open(docroot.child('globalcontext.pickle') )),48 return render_to_response(template_names, RequestContext(request, { 49 'doc': pickle.load(open(doc, 'rb')), 50 'env': pickle.load(open(docroot.child('globalcontext.pickle'), 'rb')), 50 51 'update_date': datetime.datetime.fromtimestamp(docroot.child('last_build').mtime()), 51 52 'home': urlresolvers.reverse(document, kwargs={'lang':lang, 'version':version, 'url':''}), 52 }) 53 'search': urlresolvers.reverse(search, kwargs={'lang':lang, 'version':version}), 54 })) 53 55 54 56 def images(request, lang, version, path): … … 67 69 path = path, 68 70 ) 71 72 def search(request, lang, version): 73 if lang != 'en' or version != 'dev': raise Http404() 74 75 docroot = Path(settings.DOCS_PICKLE_ROOT) 76 77 # Remove the 'cof' GET variable from the query string so that the page 78 # linked to by the Javascript fallback doesn't think its inside an iframe. 79 mutable_get = request.GET.copy() 80 if 'cof' in mutable_get: 81 del mutable_get['cof'] 82 83 return render_to_response('docs/search.html', RequestContext(request, { 84 'query': request.GET.get('q'), 85 'query_string': mutable_get.urlencode(), 86 'env': pickle.load(open(docroot.child('globalcontext.pickle'), 'rb')), 87 'home': urlresolvers.reverse(document, kwargs={'lang':lang, 'version':version, 'url':''}), 88 'search': urlresolvers.reverse(search, kwargs={'lang':lang, 'version':version}), 89 }))
