summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-03-03 06:55:54 -0600
committerDan McGee <dan@archlinux.org>2010-03-03 06:55:54 -0600
commit83b7b94c0b062b0c209ea47de9180f28db6dbb81 (patch)
tree10996dee5eadc35603a59bfcd8a2c7d55b3d2de1 /packages
parent558fad8bee8b456eef23532ef2c15f897414be86 (diff)
parentf7e15ed728d7c5e3470f6127cc21e64baefcbfb2 (diff)
Merge branch 'master' into cdn-jquery
Conflicts: templates/todolists/view.html
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):