diff options
Diffstat (limited to 'archaeological_operations/models.py')
| -rw-r--r-- | archaeological_operations/models.py | 8 | 
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): | 
