From 3de2ce225f6c953bff0ce32496618e45ba9543ac Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 13 Oct 2014 03:07:06 +0200 Subject: Work on pie and charts for dashboards (refs #1617) --- archaeological_operations/models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'archaeological_operations') diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 7e4bd73b6..d865c1ff9 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -336,8 +336,12 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem): @classmethod def get_years(cls): - return [res['year'] for res in list(cls.objects.values('year').annotate( - Count("id")).order_by())] + max_year = datetime.date.today().year + 1 + return [res['year'] for res in list( + cls.objects.exclude( year__isnull=True + ).exclude(year__gt=max_year + ).values('year' + ).annotate(Count("id")).order_by())] @classmethod def get_by_year(cls, year): -- cgit v1.2.3