Mercurial > public > sg101
diff core/views.py @ 591:1982996ce365
Created a "fixed page" facility.
Reworked the last few commits. We now generate HTML snippets from
restructured text files. These are {% include'd %} by a fixed
page template. This is for bitbucket issue #8.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 12 May 2012 14:57:45 -0500 |
parents | ee87ea74d46b |
children | 89b240fe9297 |
line wrap: on
line diff
--- a/core/views.py Thu May 10 20:32:19 2012 -0500 +++ b/core/views.py Sat May 12 14:57:45 2012 -0500 @@ -5,9 +5,9 @@ from django.contrib.auth.models import User from django.http import HttpResponse from django.shortcuts import render_to_response -from django.template import RequestContext from django.contrib.auth.decorators import login_required from django.views.decorators.http import require_GET +from django.views.generic import TemplateView import django.utils.simplejson as json @@ -36,3 +36,20 @@ users = User.objects.filter(is_active=True, username__istartswith=q).values_list('username', flat=True)[:limit] return HttpResponse(json.dumps(list(users)), content_type='application/json') + + +class FixedView(TemplateView): + """ + For displaying our "fixed" views generated with the custom command + make_fixed_page. + + """ + template_name = 'fixed/base.html' + title = '' + content_template = '' + + def get_context_data(self, **kwargs): + context = super(FixedView, self).get_context_data(**kwargs) + context['title'] = self.title + context['content_template'] = self.content_template + return context