diff options
author | Dan McGee <dan@archlinux.org> | 2010-03-27 22:58:02 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-03-28 00:09:42 +0100 |
commit | 1113462edcf69b81e93a9545198c1091e3bf6703 (patch) | |
tree | 84503426ee60cf85746914f2729ec1236fa22df5 /packages | |
parent | e317cf560aeb02c38b97193472f31a0caf92ce16 (diff) | |
download | archweb-1113462edcf69b81e93a9545198c1091e3bf6703.tar.gz archweb-1113462edcf69b81e93a9545198c1091e3bf6703.tar.xz |
Simplify code now that pkgbase is always defined
This allows some of our queries to get a lot simpler as well as removing the
pkgbase_safe property added earlier.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages')
-rw-r--r-- | packages/views.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/views.py b/packages/views.py index 47ad1d6..efb64c5 100644 --- a/packages/views.py +++ b/packages/views.py @@ -48,12 +48,12 @@ def update(request): for pkg in pkgs: maints = pkg.maintainers if mode == 'adopt' and request.user not in maints: - pr = PackageRelation(pkgbase=pkg.pkgbase_safe, + pr = PackageRelation(pkgbase=pkg.pkgbase, user=request.user, type=PackageRelation.MAINTAINER) pr.save() elif mode == 'disown' and request.user in maints: - rels = PackageRelation.objects.filter(pkgbase=pkg.pkgbase_safe, + rels = PackageRelation.objects.filter(pkgbase=pkg.pkgbase, user=request.user) rels.delete() @@ -148,10 +148,10 @@ def search(request, page=None): if form.cleaned_data['maintainer'] == 'orphan': inner_q = PackageRelation.objects.all().values('pkgbase') - packages = packages.exclude(Q(pkgname__in=inner_q) | Q(pkgbase__in=inner_q)) + packages = packages.exclude(pkgbase__in=inner_q) elif form.cleaned_data['maintainer']: inner_q = PackageRelation.objects.filter(user__username=form.cleaned_data['maintainer']).values('pkgbase') - packages = packages.filter(Q(pkgname__in=inner_q) | Q(pkgbase__in=inner_q)) + packages = packages.filter(pkgbase__in=inner_q) if form.cleaned_data['flagged'] == 'Flagged': packages=packages.filter(needupdate=True) |