From b8f7b08f207b23998607771a66b12925d9fe95d6 Mon Sep 17 00:00:00 2001 From: Sean Finney Date: Sun, 16 May 2010 11:58:36 +0200 Subject: Frontpage in django, and index view --- patchtracker/views.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'patchtracker/views.py') diff --git a/patchtracker/views.py b/patchtracker/views.py index b125681..0a316eb 100644 --- a/patchtracker/views.py +++ b/patchtracker/views.py @@ -66,3 +66,10 @@ def download_patch(request, patchType, package, version, patchName): elif patchType == "series": patch = pkg.diffhandler().series().fetch(patchName) return django.http.HttpResponse(patch, mimetype="text/plain") + +def frontpage(request): + nonlibs = [idx for idx in models.SourcePackage.objects.filter(~django.db.models.Q(name__startswith='lib')).extra(select={'index' : "SUBSTR(name, 1, 1)"}).distinct().values_list('index', flat=True)] + libs = [idx for idx in models.SourcePackage.objects.filter(name__startswith='lib').extra(select={'index' : "SUBSTR(name, 1, 4)"}).distinct().values_list('index', flat=True)] + indices = sorted(nonlibs + libs) + extra = { 'indices':indices, 'conf':Conf } + return django.shortcuts.render_to_response('frontpage.html', extra) -- cgit v1.2.3