From 15ceff77fef19819cba43e866938311aeffd0732 Mon Sep 17 00:00:00 2001 From: eliott Date: Sat, 29 Dec 2007 15:34:02 -0800 Subject: Modified render_template and renamed it to render_response (consistent with archweb_pub conventions). Moved pkgmaint_guide to a template. --- public/views.py | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'public') diff --git a/public/views.py b/public/views.py index 6c698312..2cda74be 100644 --- a/public/views.py +++ b/public/views.py @@ -1,5 +1,5 @@ from django.http import HttpResponse -from archweb_dev.utils import render_template +from archweb_dev.lib.utils import render_response from django.contrib.auth.models import User from archweb_dev.packages.models import Package, Repo from archweb_dev.news.models import News @@ -7,53 +7,53 @@ from archweb_dev.public.models import Donator, Mirror def index(request): - # get the most recent 10 news items - news = News.objects.order_by('-postdate', '-id')[:10] - pkgs = Package.objects.exclude(repo__name__exact='Testing').order_by('-last_update')[:15] - repos = Repo.objects.order_by('name') - return render_template('public/index.html', request, {'news_updates':news,'pkg_updates':pkgs,'repos':repos}) + # get the most recent 10 news items + news = News.objects.order_by('-postdate', '-id')[:10] + pkgs = Package.objects.exclude(repo__name__exact='Testing').order_by('-last_update')[:15] + repos = Repo.objects.order_by('name') + return render_response(request, 'public/index.html', {'news_updates':news,'pkg_updates':pkgs,'repos':repos}) def about(request): - return render_template('public/about.html', request) + return render_response(request, 'public/about.html') def art(request): - return render_template('public/art.html', request) + return render_response(request, 'public/art.html') def cvs(request): - return render_template('public/cvs.html', request) + return render_response(request, 'public/cvs.html') def developers(request): - devs = User.objects.order_by('username') - return render_template('public/developers.html', request, {'devs':devs}) + devs = User.objects.order_by('username') + return render_response(request, 'public/developers.html', {'devs':devs}) def donate(request): - donor_count = Donator.objects.count() - splitval = donor_count / 4 - slice1 = Donator.objects.all()[:splitval] - slice2 = Donator.objects.all()[(splitval):(splitval*2)] - slice3 = Donator.objects.all()[(splitval*2):(donor_count-splitval)] - slice4 = Donator.objects.all()[(donor_count-splitval):donor_count] - return render_template('public/donate.html', request, - {'slice1':slice1,'slice2':slice2,'slice3':slice3,'slice4':slice4}) + donor_count = Donator.objects.count() + splitval = donor_count / 4 + slice1 = Donator.objects.all()[:splitval] + slice2 = Donator.objects.all()[(splitval):(splitval*2)] + slice3 = Donator.objects.all()[(splitval*2):(donor_count-splitval)] + slice4 = Donator.objects.all()[(donor_count-splitval):donor_count] + return render_response(request, 'public/donate.html', + {'slice1':slice1,'slice2':slice2,'slice3':slice3,'slice4':slice4}) def download(request): - mirrors = Mirror.objects.order_by('country', 'domain') - return render_template('public/download.html', request, {'mirrors':mirrors}) + mirrors = Mirror.objects.order_by('country', 'domain') + return render_response(request, 'public/download.html', {'mirrors':mirrors}) def irc(request): - return render_template('public/irc.html', request) + return render_response(request, 'public/irc.html') def moreforums(request): - return render_template('public/moreforums.html', request) + return render_response(request, 'public/moreforums.html') def press(request): - return render_template('public/press.html', request) + return render_response(request, 'public/press.html') def projects(request): - return render_template('public/projects.html', request) + return render_response(request, 'public/projects.html') def robots(request): return HttpResponse("User-agent: *\nDisallow: /\n", mimetype="text/plain") def denied(request): - return render_template('public/denied.html', request) + return render_response(request, 'public/denied.html') -- cgit v1.2.3-54-g00ecf