diff options
author | Dan McGee <dan@archlinux.org> | 2011-03-23 12:47:26 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-03-23 12:47:26 -0500 |
commit | a52ddb5c48dd2cb7856779f64611679aca7d660d (patch) | |
tree | 608533bb062a6cd2e2d59b736afc3804063551af | |
parent | f46e5b1a94c845ea2125b4f9d6777dff56c9ad29 (diff) |
Allow virtual base packages to display in web interface
Repurpose the old group details page to show a listing of all packages
built from a particular pkgbase value, even if this value is not an
actual package.
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | packages/views.py | 26 | ||||
-rw-r--r-- | templates/packages/details.html | 3 |
2 files changed, 25 insertions, 4 deletions
diff --git a/packages/views.py b/packages/views.py index 374a1a20..263165fd 100644 --- a/packages/views.py +++ b/packages/views.py @@ -83,9 +83,29 @@ def update(request): def details(request, name='', repo='', arch=''): if all([name, repo, arch]): - pkg = get_object_or_404(Package, - pkgname=name, repo__name__iexact=repo, arch__name=arch) - return direct_to_template(request, 'packages/details.html', {'pkg': pkg, }) + try: + pkg = Package.objects.get(pkgname=name, + repo__name__iexact=repo, arch__name=arch) + return direct_to_template(request, 'packages/details.html', + {'pkg': pkg, }) + except Package.DoesNotExist: + arch = get_object_or_404(Arch, name=arch) + arches = [ arch ] + arches.extend(Arch.objects.filter(agnostic=True)) + repo = get_object_or_404(Repo, name__iexact=repo) + pkgs = Package.objects.filter(pkgbase=name, + repo__testing=repo.testing, arch__in=arches) + pkgs = pkgs.select_related('arch', 'repo').order_by('pkgname') + if len(pkgs) == 0: + raise Http404 + context = { + 'list_title': 'Split Package Details', + 'name': name, + 'arch': arch, + 'packages': pkgs, + } + return direct_to_template(request, 'packages/packages_list.html', + context) else: return redirect("/packages/?arch=%s&repo=%s&q=%s" % ( arch.lower(), repo.title(), name)) diff --git a/templates/packages/details.html b/templates/packages/details.html index 051726bd..4253f0b3 100644 --- a/templates/packages/details.html +++ b/templates/packages/details.html @@ -96,7 +96,8 @@ <td><a href="{{ pkg.base_package.get_absolute_url }}" title="Package details for {{ pkg.base_package.pkgname }}">{{ pkg.pkgbase }}</a></td> {% else %} - <td>{{ pkg.pkgbase }}</td> + <td><a href="../{{ pkg.pkgbase }}/" + title="Split package details for {{ pkg.pkgbase }}">{{ pkg.pkgbase }}</a></td> {% endif %} </tr> {% endifequal %} |