diff options
author | Dan McGee <dan@archlinux.org> | 2013-01-23 09:18:59 -0700 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2013-01-23 09:18:59 -0700 |
commit | a10798b756bbfc5d8dbad76546ca670efca75e56 (patch) | |
tree | d378a3a5140501b46e0e99c8398b12ca78145dc8 /packages/views/flag.py | |
parent | be49f26a815cca589c625ff8dd99c85a80262281 (diff) |
Use querysets for calls to get_object_or_404(Package)
This works better in most cases since we need the architecture and
repository objects at some point during the view process.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages/views/flag.py')
-rw-r--r-- | packages/views/flag.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/views/flag.py b/packages/views/flag.py index dadadd19..edb3f092 100644 --- a/packages/views/flag.py +++ b/packages/views/flag.py @@ -49,7 +49,7 @@ def flaghelp(request): @never_cache def flag(request, name, repo, arch): - pkg = get_object_or_404(Package, + pkg = get_object_or_404(Package.objects.normal(), pkgname=name, repo__name__iexact=repo, arch__name=arch) if pkg.flag_date is not None: # already flagged. do nothing. @@ -158,7 +158,7 @@ def flag_confirmed(request, name, repo, arch): @permission_required('main.change_package') def unflag(request, name, repo, arch): - pkg = get_object_or_404(Package, + pkg = get_object_or_404(Package.objects.normal(), pkgname=name, repo__name__iexact=repo, arch__name=arch) pkg.flag_date = None pkg.save() @@ -166,7 +166,7 @@ def unflag(request, name, repo, arch): @permission_required('main.change_package') def unflag_all(request, name, repo, arch): - pkg = get_object_or_404(Package, + pkg = get_object_or_404(Package.objects.normal(), pkgname=name, repo__name__iexact=repo, arch__name=arch) # find all packages from (hopefully) the same PKGBUILD pkgs = Package.objects.filter(pkgbase=pkg.pkgbase, |