diff options
author | Dan McGee <dan@archlinux.org> | 2010-06-20 23:59:18 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-06-20 23:59:18 -0500 |
commit | d767658debf24fe26ba42eae0f339868d7faa2b4 (patch) | |
tree | ff7c768eb93ff2dca32daeab357fddcf67bf78c3 /packages | |
parent | f123348c7dfb50353a6a555bfe44d11defa60269 (diff) |
Get a more accurate count of adopted packages
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages')
-rw-r--r-- | packages/views.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/views.py b/packages/views.py index f085c913..eb2276a0 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" % ( |