summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/views.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/packages/views.py b/packages/views.py
index 97929ed3..8a2b4ec3 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -7,6 +7,7 @@ from django.shortcuts import get_object_or_404
from django.contrib.auth.models import User
from django.contrib.auth.decorators import permission_required
from django.contrib.admin.widgets import AdminDateWidget
+from django.views.decorators.vary import vary_on_headers
from django.views.generic import list_detail
from django.db.models import Q
@@ -60,7 +61,7 @@ def update(request):
def details(request, name='', repo='', arch=''):
if all([name, repo, arch]):
- pkg= get_object_or_404(Package,
+ pkg = get_object_or_404(Package,
pkgname=name, repo__name__iexact=repo, arch__name=arch)
return render_to_response('packages/details.html', RequestContext(
request, {'pkg': pkg, }))
@@ -178,10 +179,15 @@ def search(request, page=None):
template_object_name="package",
extra_context=page_dict)
-def files(request, pkgid):
- pkg = get_object_or_404(Package, id=pkgid)
- files = PackageFile.objects.filter(pkg=pkgid)
- return render_to_response('packages/files.html', RequestContext(request, {'pkg':pkg,'files':files}))
+@vary_on_headers('X-Requested-With')
+def files(request, name='', repo='', arch=''):
+ pkg = get_object_or_404(Package,
+ pkgname=name, repo__name__iexact=repo, arch__name=arch)
+ files = PackageFile.objects.filter(pkg=pkg).order_by('path')
+ template = 'packages/files.html'
+ if request.is_ajax():
+ template = 'packages/files-list.html'
+ return render_to_response(template, RequestContext(request, {'pkg':pkg,'files':files}))
@permission_required('main.change_package')
def unflag(request, pkgid):