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
commite04a42aa7e5011f9173226af851e8b15bafcef06 (patch)
tree01d71586e797f599c1c0bafb51671f0c42f63e1a /archaeological_operations/models.py
parentb3f294f3272138e2d7a8032db085322219b71533 (diff)
downloadIshtar-e04a42aa7e5011f9173226af851e8b15bafcef06.tar.bz2
Ishtar-e04a42aa7e5011f9173226af851e8b15bafcef06.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):