diff options
author | Dan McGee <dan@archlinux.org> | 2012-04-18 22:05:43 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-05-02 16:37:46 +0200 |
commit | badc535aeb1d310a9b8aa59aade07045e6eae653 (patch) | |
tree | af644de8b034d45ba296ab39da93b359312a38ca /devel | |
parent | f3e0adcb2fc9a26e2ad9337a47550a37590074d9 (diff) | |
download | archweb-badc535aeb1d310a9b8aa59aade07045e6eae653.tar.gz archweb-badc535aeb1d310a9b8aa59aade07045e6eae653.tar.xz |
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 'devel')
-rw-r--r-- | devel/views.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/devel/views.py b/devel/views.py index 85acda7..7ef3336 100644 --- a/devel/views.py +++ b/devel/views.py @@ -249,7 +249,8 @@ def report(request, report_name, username=None): if username: pkg_ids = set(packages.values_list('id', flat=True)) bad_files = bad_files.filter(pkg__in=pkg_ids) - bad_files = bad_files.values_list('pkg_id', flat=True).distinct() + bad_files = bad_files.values_list( + 'pkg_id', flat=True).order_by().distinct() packages = packages.filter(id__in=set(bad_files)) elif report_name == 'uncompressed-info': title = 'Packages with uncompressed infopages' @@ -260,7 +261,8 @@ def report(request, report_name, username=None): if username: pkg_ids = set(packages.values_list('id', flat=True)) bad_files = bad_files.filter(pkg__in=pkg_ids) - bad_files = bad_files.values_list('pkg_id', flat=True).distinct() + bad_files = bad_files.values_list( + 'pkg_id', flat=True).order_by().distinct() packages = packages.filter(id__in=set(bad_files)) elif report_name == 'unneeded-orphans': title = 'Orphan packages required by no other packages' |