summaryrefslogtreecommitdiff
path: root/archaeological_operations/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2014-10-13 03:07:06 +0200
committerÉtienne Loks <etienne.loks@proxience.com>2014-10-13 03:07:06 +0200
commit3de2ce225f6c953bff0ce32496618e45ba9543ac (patch)
tree01d71586e797f599c1c0bafb51671f0c42f63e1a /archaeological_operations/models.py
parented63bda40bdc8d6df6e913f838426906e1567613 (diff)
downloadIshtar-3de2ce225f6c953bff0ce32496618e45ba9543ac.tar.bz2
Ishtar-3de2ce225f6c953bff0ce32496618e45ba9543ac.zip
Work on pie and charts for dashboards (refs #1617)
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r--archaeological_operations/models.py8
1 files changed, 6 insertions, 2 deletions
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):