From 5b773f6a3cc454e26693b83169760369cf0a0b62 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 22 Oct 2012 00:08:24 +0200 Subject: Djangoization - Major refactoring (step 15) * works on dashboards --- archaeological_context_records/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'archaeological_context_records/models.py') diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 64772627b..c558587aa 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -169,8 +169,9 @@ class ContextRecord(BaseHistorizedItem, OwnPerms): def get_years(cls): years = set() for res in list(cls.objects.values('operation__start_date')): - yr = res['operation__start_date'].year - years.add(yr) + if res['operation__start_date']: + yr = res['operation__start_date'].year + years.add(yr) return list(years) @classmethod -- cgit v1.2.3