+ 'award_count': award_count,
+ 'awards' : awards,
+ 'badge' : badge,
+ }, context_instance=RequestContext(request))
+
+def page(request, path):
+ if path in settings.STATIC_PAGE_REGISTRY:
+ try:
+ page = Page.objects.get(id=settings.STATIC_PAGE_REGISTRY[path])
+
+ if (not page.published) and (not request.user.is_superuser):
+ raise Http404
+ except:
+ raise Http404
+ else:
+ raise Http404
+
+ template = page.extra.get('template', 'default')
+ sidebar = page.extra.get('sidebar', '')
+
+ if template == 'default':
+ base = 'base_content.html'
+ elif template == 'sidebar':
+ base = 'base.html'
+
+ sidebar_render = page.extra.get('render', 'markdown')
+
+ if sidebar_render == 'markdown':
+ sidebar = page._as_markdown(sidebar)
+ elif sidebar_render == 'html':
+ sidebar = mark_safe(sidebar)
+
+ else:
+ return HttpResponse(page.body, mimetype=page.extra.get('mimetype', 'text/html'))
+
+ render = page.extra.get('render', 'markdown')
+
+ if render == 'markdown':
+ body = page.as_markdown()
+ elif render == 'html':
+ body = mark_safe(page.body)
+ else:
+ body = page.body
+
+ return render_to_response('page.html', {
+ 'page' : page,
+ 'body' : body,
+ 'sidebar': sidebar,
+ 'base': base,