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/urls.py | 4 +++- patchtracker/views.py | 7 +++++++ templates/frontpage.html | 40 ++++++++++++++++++++++++++++++++++++++++ templates/frontpage.tmpl | 36 ------------------------------------ 4 files changed, 50 insertions(+), 37 deletions(-) create mode 100644 templates/frontpage.html delete mode 100644 templates/frontpage.tmpl diff --git a/patchtracker/urls.py b/patchtracker/urls.py index 4108086..b174272 100644 --- a/patchtracker/urls.py +++ b/patchtracker/urls.py @@ -6,11 +6,13 @@ urlpatterns = patterns('', views.package_vers), url(r'^package/(?P\w+)$', views.display_toc), + url(r'^index/(?P[^/]+)$', + views.display_toc), url(r'^email/(?P.*)$', views.maintainer_search), url(r'^patch/(?P(debianonly|misc|nondebian|series))/view/(?P\w+)/(?P[^/]+)/(?P.*)$', views.display_patch), url(r'^patch/(?P(debianonly|misc|nondebian|series))/dl/(?P\w+)/(?P[^/]+)/(?P.*)$', views.download_patch), - + url(r'^$', views.frontpage), ) 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) diff --git a/templates/frontpage.html b/templates/frontpage.html new file mode 100644 index 0000000..517feb7 --- /dev/null +++ b/templates/frontpage.html @@ -0,0 +1,40 @@ +{% extends "base.html" %} +{% block title %} +Debian Project patch tracking system +{% endblock %} +{% block content %} +

Debian Project patch tracking system

+

Introduction

+

+ This site is used to track/visualize the changes made in the source code + of software packaged in the debian distribution. +

+

Quick access

+
    +
  • {{ conf.root_url }}/package/<p> + - search for package p
  • +
  • {{ conf.root_url }}/package/<p>/<v> + - go directly to the page for package p, version v
  • +
  • {{ conf.root_url }}/email/<u> + - show packages with maintainer address containing u.
  • +
+

Browse patches by package name

+ +

Jump to package / Package search

+
+
+ + +
+
+{% endblock %} diff --git a/templates/frontpage.tmpl b/templates/frontpage.tmpl deleted file mode 100644 index 7b103a0..0000000 --- a/templates/frontpage.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -#import templates -#extends templates.skeleton -#def title -Debian Project patch tracking system -#end def -#def body -

Debian Project patch tracking system

-

Introduction

-

- This site is used to track/visualize the changes made in the source code - of software packaged in the debian distribution. -

-

Quick access

-
    -
  • $conf.root_url/package/<p> - - search for package p
  • -
  • $conf.root_url/package/<p>/<v> - - go directly to the page for package p, version v
  • -
  • $conf.root_url/email/<u> - - show packages with maintainer address containing u.
  • -
-

Browse patches by package name

-#set $links = [ ""+k+"" for k in $indices ] -#set $out = " - ".join($links) - -

Jump to package / Package search

-
-
- - -
-
- -#end def -- cgit v1.2.3