summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-01-21 00:31:37 +0100
committerDan McGee <dan@archlinux.org>2011-01-21 00:31:37 +0100
commit7d043be0b3d090d2f675af5b86856693aa73e787 (patch)
tree01ee8235193e00821c13ed994935c31b019f385a
parent523a15f81e819379d1d9ae8412ebd8a7c017a512 (diff)
downloadarchweb-7d043be0b3d090d2f675af5b86856693aa73e787.tar.gz
archweb-7d043be0b3d090d2f675af5b86856693aa73e787.tar.xz
Add an 'unflag all' option
This allows the exact opposite of the 'flag' option as presented to the end user, especially helpful for split packages. The original single unflag package option is also still available. Implements FS#22520. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--packages/urls.py1
-rw-r--r--packages/views.py18
-rw-r--r--templates/packages/details.html1
3 files changed, 16 insertions, 4 deletions
diff --git a/packages/urls.py b/packages/urls.py
index c9006a1..b7ce5c7 100644
--- a/packages/urls.py
+++ b/packages/urls.py
@@ -6,6 +6,7 @@ package_patterns = patterns('packages.views',
(r'^maintainer/$', 'getmaintainer'),
(r'^flag/$', 'flag'),
(r'^unflag/$', 'unflag'),
+ (r'^unflag/all/$', 'unflag_all'),
(r'^download/$', 'download'),
)
diff --git a/packages/views.py b/packages/views.py
index e00e6f9..4f7c3b9 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -232,7 +232,7 @@ def search(request, page=None):
extra_context=page_dict)
@vary_on_headers('X-Requested-With')
-def files(request, name='', repo='', arch=''):
+def files(request, name, repo, arch):
pkg = get_object_or_404(Package,
pkgname=name, repo__name__iexact=repo, arch__name=arch)
fileslist = PackageFile.objects.filter(pkg=pkg).order_by('path')
@@ -243,7 +243,7 @@ def files(request, name='', repo='', arch=''):
{'pkg':pkg, 'files':fileslist})
@permission_required('main.change_package')
-def unflag(request, name='', repo='', arch=''):
+def unflag(request, name, repo, arch):
pkg = get_object_or_404(Package,
pkgname=name, repo__name__iexact=repo, arch__name=arch)
pkg.flag_date = None
@@ -251,6 +251,16 @@ def unflag(request, name='', repo='', arch=''):
return redirect(pkg)
@permission_required('main.change_package')
+def unflag_all(request, name, repo, arch):
+ pkg = get_object_or_404(Package,
+ pkgname=name, repo__name__iexact=repo, arch__name=arch)
+ # find all packages from (hopefully) the same PKGBUILD
+ pkgs = Package.objects.filter(
+ pkgbase=pkg.pkgbase, repo__testing=pkg.repo.testing)
+ pkgs.update(flag_date=None)
+ return redirect(pkg)
+
+@permission_required('main.change_package')
@never_cache
def signoffs(request):
packages = Package.objects.select_related('arch', 'repo', 'signoffs').filter(repo__testing=True).order_by("pkgname")
@@ -309,7 +319,7 @@ class FlagForm(forms.Form):
required=False)
@never_cache
-def flag(request, name='', repo='', arch=''):
+def flag(request, name, repo, arch):
pkg = get_object_or_404(Package,
pkgname=name, repo__name__iexact=repo, arch__name=arch)
context = {'pkg': pkg}
@@ -361,7 +371,7 @@ def flag(request, name='', repo='', arch=''):
return direct_to_template(request, 'packages/flag.html', context)
-def download(request, name='', repo='', arch=''):
+def download(request, name, repo, arch):
pkg = get_object_or_404(Package,
pkgname=name, repo__name__iexact=repo, arch__name=arch)
mirrorurl = MirrorUrl.objects.filter(mirror__country='Any',
diff --git a/templates/packages/details.html b/templates/packages/details.html
index 1b01b3c..fcbaf08 100644
--- a/templates/packages/details.html
+++ b/templates/packages/details.html
@@ -28,6 +28,7 @@
{% endif %}{% endwith %}
{% if user.is_authenticated %}
<li><a href="unflag/" title="Unflag this package">Click here to unflag</a></li>
+ <li><a href="unflag/all/" title="Unflag all matching pkgbase">Click here to unflag all split packages</a></li>
{% endif %}
{% else %}
<li><a href="flag/" title="Flag {{ pkg.pkgname }} as out-of-date">Flag Package Out-of-Date</a>