diff options
-rw-r--r-- | patchtracker/urls.py | 4 | ||||
-rw-r--r-- | patchtracker/views.py | 7 | ||||
-rw-r--r-- | templates/frontpage.html (renamed from templates/frontpage.tmpl) | 30 |
3 files changed, 27 insertions, 14 deletions
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<index>\w+)$', views.display_toc), + url(r'^index/(?P<index>[^/]+)$', + views.display_toc), url(r'^email/(?P<maintainer>.*)$', views.maintainer_search), url(r'^patch/(?P<patchType>(debianonly|misc|nondebian|series))/view/(?P<package>\w+)/(?P<version>[^/]+)/(?P<patchName>.*)$', views.display_patch), url(r'^patch/(?P<patchType>(debianonly|misc|nondebian|series))/dl/(?P<package>\w+)/(?P<version>[^/]+)/(?P<patchName>.*)$', 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.tmpl b/templates/frontpage.html index 7b103a0..517feb7 100644 --- a/templates/frontpage.tmpl +++ b/templates/frontpage.html @@ -1,9 +1,8 @@ -#import templates -#extends templates.skeleton -#def title +{% extends "base.html" %} +{% block title %} Debian Project patch tracking system -#end def -#def body +{% endblock %} +{% block content %} <h1>Debian Project patch tracking system</h1> <h2>Introduction</h2> <p> @@ -12,18 +11,24 @@ Debian Project patch tracking system </p> <h2>Quick access</h2> <ul> - <li><span class="url">$conf.root_url/package/<p></span> + <li><span class="url">{{ conf.root_url }}/package/<p></span> - search for package p</li> - <li><span class="url">$conf.root_url/package/<p>/<v></span> + <li><span class="url">{{ conf.root_url }}/package/<p>/<v></span> - go directly to the page for package p, version v</li> - <li><span class="url">$conf.root_url/email/<u></span> + <li><span class="url">{{ conf.root_url }}/email/<u></span> - show packages with maintainer address containing u.</li> </ul> <h3>Browse patches by package name</h3> -#set $links = [ "<a href=\"index/"+k+"\">"+k+"</a>" for k in $indices ] -#set $out = " - ".join($links) <div class="quicklinks"> - $out + {% for index in indices %} + <a href="{% url patchtracker.views.display_toc index=index %}">{{ index }}</a> + {% if not forloop.last %} + - + {% endif %} + {% empty %} + Error fetching indices of available packages + {% endfor %} + <!-- <a href="index/"{{ k }}">{{ k }}</a> --> </div> <h3>Jump to package / Package search</h3> <div class="framed"> @@ -32,5 +37,4 @@ Debian Project patch tracking system <input type="submit" name="submit" /> </form> </div> - -#end def +{% endblock %} |