summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-08-26 18:52:49 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-08-26 18:52:49 +0200
commit29742aa7583316f5b91c1367a4782d6fd02a9822 (patch)
treec58c93d887fee773cb8acdd2df6867ee5f051cd1 /ishtar_common
parent177b04af802510b18db21467f1855a923eae787e (diff)
downloadIshtar-29742aa7583316f5b91c1367a4782d6fd02a9822.tar.bz2
Ishtar-29742aa7583316f5b91c1367a4782d6fd02a9822.zip
Django 1.11: fix dashboards - explicit ordering is needed when using distinct
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/models.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 19f557511..b2c45c86f 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1409,7 +1409,8 @@ class DashboardFormItem(object):
q = cls.objects.filter(**{date_var + '__isnull': False})
if fltr:
q = q.filter(**fltr)
- return q.filter(**{date_var + '__year': year}).distinct('pk')
+ return q.filter(
+ **{date_var + '__year': year}).order_by('pk').distinct('pk')
@classmethod
def get_by_month(cls, year, month, fltr={}, date_source='creation'):
@@ -1419,14 +1420,14 @@ class DashboardFormItem(object):
q = q.filter(**fltr)
q = q.filter(
**{date_var + '__year': year, date_var + '__month': month})
- return q.distinct('pk')
+ return q.order_by('pk').distinct('pk')
@classmethod
def get_total_number(cls, fltr={}):
q = cls.objects
if fltr:
q = q.filter(**fltr)
- return q.distinct('pk').count()
+ return q.order_by('pk').distinct('pk').count()
class Dashboard(object):