diff options
Diffstat (limited to 'archaeological_context_records/models.py')
-rw-r--r-- | archaeological_context_records/models.py | 5 |
1 files changed, 3 insertions, 2 deletions
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 |