summaryrefslogtreecommitdiff
path: root/packages/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/views.py')
-rw-r--r--packages/views.py33
1 files changed, 27 insertions, 6 deletions
diff --git a/packages/views.py b/packages/views.py
index 4101c538..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))
@@ -107,15 +127,16 @@ def group_details(request, arch, name):
arches = [ arch ]
arches.extend(Arch.objects.filter(agnostic=True))
pkgs = Package.objects.filter(groups__name=name, arch__in=arches)
- pkgs = pkgs.order_by('pkgname')
+ pkgs = pkgs.select_related('arch', 'repo').order_by('pkgname')
if len(pkgs) == 0:
raise Http404
context = {
- 'groupname': name,
+ 'list_title': 'Group Details',
+ 'name': name,
'arch': arch,
'packages': pkgs,
}
- return direct_to_template(request, 'packages/group_details.html', context)
+ return direct_to_template(request, 'packages/packages_list.html', context)
def getmaintainer(request, name, repo, arch):
"Returns the maintainers as plaintext."