summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-04-18 15:05:43 -0500
committerDan McGee <dan@archlinux.org>2012-05-02 09:37:46 -0500
commitbadc535aeb1d310a9b8aa59aade07045e6eae653 (patch)
treeaf644de8b034d45ba296ab39da93b359312a38ca /packages
parentf3e0adcb2fc9a26e2ad9337a47550a37590074d9 (diff)
downloadarchweb-badc535aeb1d310a9b8aa59aade07045e6eae653.tar.gz
archweb-badc535aeb1d310a9b8aa59aade07045e6eae653.zip
Ensure order_by default value is cleared when using distinct()
Otherwise the queryset returns nonsensical results. I find the design of this less than obvious but so be it; we can ensure the results work regardless of a default ordering on the model. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'packages')
-rw-r--r--packages/utils.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/packages/utils.py b/packages/utils.py
index a3c13b17..8d00bd68 100644
--- a/packages/utils.py
+++ b/packages/utils.py
@@ -218,7 +218,8 @@ def attach_maintainers(packages):
packages = list(packages)
pkgbases = set(p.pkgbase for p in packages)
rels = PackageRelation.objects.filter(type=PackageRelation.MAINTAINER,
- pkgbase__in=pkgbases).values_list('pkgbase', 'user_id').distinct()
+ pkgbase__in=pkgbases).values_list(
+ 'pkgbase', 'user_id').order_by().distinct()
# get all the user objects we will need
user_ids = set(rel[1] for rel in rels)