diff options
author | Dan McGee <dan@archlinux.org> | 2010-09-03 13:16:18 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-09-03 13:16:18 -0500 |
commit | 7c7f57f6ac43af5350f04c6eaeb927063ad4daee (patch) | |
tree | 884a095ae22032ab46da398dcd268e34697f56b2 | |
parent | 45a14b3cbc826d97b2c630b0e95656f01638d03b (diff) |
Use direct_to_template in public views
Saves the hassle of needing to wrap everything in RequestContext()
manually.
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | public/views.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/public/views.py b/public/views.py index be0ff80d..f1d08a23 100644 --- a/public/views.py +++ b/public/views.py @@ -4,9 +4,8 @@ from . import utils from django.contrib.auth.models import User from django.db.models import Q -from django.shortcuts import render_to_response -from django.template import RequestContext from django.views.generic import list_detail +from django.views.generic.simple import direct_to_template def index(request): @@ -15,8 +14,7 @@ def index(request): 'news_updates': News.objects.order_by('-postdate', '-id')[:10], 'pkg_updates': pkgs, } - return render_to_response('public/index.html', context, - context_instance=RequestContext(request)) + return direct_to_template(request, 'public/index.html', context) def userlist(request, type='Developers'): users = User.objects.order_by('username') @@ -35,15 +33,13 @@ def userlist(request, type='Developers'): 'description': msg, 'users': users, } - return render_to_response('public/userlist.html', context, - context_instance=RequestContext(request)) + return direct_to_template(request, 'public/userlist.html', context) def donate(request): context = { 'donors': Donor.objects.order_by('name'), } - return render_to_response('public/donate.html', context, - context_instance=RequestContext(request)) + return direct_to_template(request, 'public/donate.html', context) def download(request): qset = MirrorUrl.objects.filter( @@ -60,7 +56,6 @@ def feeds(request): 'arches': Arch.objects.all(), 'repos': Repo.objects.all(), } - return render_to_response('public/feeds.html', context, - context_instance=RequestContext(request)) + return direct_to_template(request, 'public/feeds.html', context) # vim: set ts=4 sw=4 et: |