From 7d043be0b3d090d2f675af5b86856693aa73e787 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 20 Jan 2011 17:31:37 -0600 Subject: 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 --- packages/urls.py | 1 + packages/views.py | 18 ++++++++++++++---- templates/packages/details.html | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/urls.py b/packages/urls.py index c9006a12..b7ce5c74 100644 --- a/packages/urls.py +++ b/packages/urls.py @@ -6,6 +6,7 @@ (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 e00e6f94..4f7c3b93 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,13 +243,23 @@ 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 pkg.save() 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): @@ -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 1b01b3c1..fcbaf083 100644 --- a/templates/packages/details.html +++ b/templates/packages/details.html @@ -28,6 +28,7 @@

Package Actions

{% endif %}{% endwith %} {% if user.is_authenticated %}
  • Click here to unflag
  • +
  • Click here to unflag all split packages
  • {% endif %} {% else %}
  • Flag Package Out-of-Date -- cgit v1.2.3-54-g00ecf