summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-06-21 06:59:18 +0200
committerDan McGee <dan@archlinux.org>2010-06-21 06:59:18 +0200
commitd767658debf24fe26ba42eae0f339868d7faa2b4 (patch)
treeff7c768eb93ff2dca32daeab357fddcf67bf78c3
parentf123348c7dfb50353a6a555bfe44d11defa60269 (diff)
downloadarchweb-d767658debf24fe26ba42eae0f339868d7faa2b4.tar.gz
archweb-d767658debf24fe26ba42eae0f339868d7faa2b4.tar.xz
Get a more accurate count of adopted packages
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--packages/views.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/views.py b/packages/views.py
index f085c91..eb2276a 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -48,19 +48,22 @@ def update(request):
pkgs = Package.objects.filter(id__in=ids, repo__in=repos)
disallowed_pkgs = Package.objects.filter(id__in=ids).exclude(
repo__in=repos)
+ count = 0
for pkg in pkgs:
maints = pkg.maintainers
if mode == 'adopt' and request.user not in maints:
pr = PackageRelation(pkgbase=pkg.pkgbase,
user=request.user,
type=PackageRelation.MAINTAINER)
+ count += 1
pr.save()
elif mode == 'disown' and request.user in maints:
rels = PackageRelation.objects.filter(pkgbase=pkg.pkgbase,
user=request.user)
+ count += rels.count()
rels.delete()
- messages.info(request, "%d packages %sed." % (count, mode))
+ messages.info(request, "%d base packages %sed." % (count, mode))
if disallowed_pkgs:
messages.warning(request,
"You do not have permission to %s: %s" % (