diff options
author | Dan McGee <dan@archlinux.org> | 2010-08-27 16:11:56 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-08-27 17:05:07 -0500 |
commit | e0674de7767a7b2bf9f83f20b2361200e4d8efe0 (patch) | |
tree | 6ae67bec8cb296cf1532f43100efab5a63bcc8bd | |
parent | 1cfcf13e1b66950a96d8a729f34108030c48c1cb (diff) |
Add a group details view
This makes the support asked for in FS#19801 a lot more useful since we
actually have an overview page for the entire group.
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | packages/views.py | 17 | ||||
-rw-r--r-- | templates/packages/group_details.html | 45 | ||||
-rw-r--r-- | urls.py | 3 |
3 files changed, 64 insertions, 1 deletions
diff --git a/packages/views.py b/packages/views.py index 1ab4749d..0a0d0afa 100644 --- a/packages/views.py +++ b/packages/views.py @@ -3,7 +3,7 @@ from django.contrib import messages from django.core.mail import send_mail from django.shortcuts import render_to_response from django.template import loader, Context, RequestContext -from django.http import HttpResponse, HttpResponseRedirect +from django.http import HttpResponse, HttpResponseRedirect, Http404 from django.shortcuts import get_object_or_404 from django.contrib.auth.models import User from django.contrib.auth.decorators import permission_required @@ -84,6 +84,21 @@ def details(request, name='', repo='', arch=''): return HttpResponseRedirect("/packages/?arch=%s&repo=%s&q=%s" % ( arch.lower(), repo.title(), name)) +def group_details(request, arch, name): + arch = get_object_or_404(Arch, name=arch) + pkgs = Package.objects.filter(packagegroup__name=name) + pkgs = pkgs.filter(Q(arch__name=arch) | Q(arch__name='any')) + pkgs = pkgs.order_by('pkgname') + if len(pkgs) == 0: + raise Http404 + context = { + 'groupname': name, + 'arch': arch, + 'packages': pkgs, + } + return render_to_response('packages/group_details.html', + RequestContext(request, context)) + def getmaintainer(request, name, repo, arch): "Returns the maintainers as plaintext." diff --git a/templates/packages/group_details.html b/templates/packages/group_details.html new file mode 100644 index 00000000..f15efaac --- /dev/null +++ b/templates/packages/group_details.html @@ -0,0 +1,45 @@ +{% extends "base.html" %} +{% block title %}Arch Linux - {{ groupname }} - Group Details{% endblock %} +{% block navbarclass %}anb-packages{% endblock %} + +{% block content %} +<div class="box"> + <h2>Details for group {{ groupname }} - {{ arch.name }}</h2> + <table class="results"> + <thead> + <tr> + <th>Arch</th> + <th>Repo</th> + <th>Name</th> + <th>Version</th> + <th>Description</th> + <th>Last Updated</th> + </tr> + </thead> + <tbody> + {% for pkg in packages %} + <tr class="{% cycle 'odd' 'even' %}"> + <td>{{ pkg.arch.name }}</td> + <td>{{ pkg.repo.name|capfirst }}</td> + <td><a href="{{ pkg.get_absolute_url }}" + title="Package details for {{ pkg.pkgname }}">{{ pkg.pkgname }}</a></td> + {% if pkg.flag_date %} + <td><span class="flagged">{{ pkg.pkgver }}-{{ pkg.pkgrel }}</span></td> + {% else %} + <td>{{ pkg.pkgver }}-{{ pkg.pkgrel }}</td> + {% endif %} + <td class="wrap">{{ pkg.pkgdesc }}</td> + <td>{{ pkg.last_update|date:"Y-m-d" }}</td> + </tr> + {% endfor %} + </tbody> + </table> +</div> +{% load cdn %}{% jquery %} +<script type="text/javascript" src="/media/jquery.tablesorter.min.js"></script> +<script type="text/javascript"> +$(document).ready(function() { + $(".results").tablesorter({widgets: ['zebra'], sortList: [[2,0]]}); +}); +</script> +{% endblock %} @@ -50,6 +50,9 @@ urlpatterns = patterns('', (r'^packages/(?P<repo>[A-z0-9\-]+)/(?P<arch>[A-z0-9]+)/(?P<name>[A-z0-9\-+.]+)/download/$', 'packages.views.download'), + (r'^groups/(?P<arch>[A-z0-9]+)/(?P<name>[A-z0-9\-+.]+)/$', + 'packages.views.group_details'), + (r'^todo/(\d+)/$', 'todolists.views.view'), (r'^todo/add/$', 'todolists.views.add'), (r'^todo/edit/(?P<list_id>\d+)/$', 'todolists.views.edit'), |