diff --git a/golem_season/models/golem_season.py b/golem_season/models/golem_season.py index bc1c363..f2d7aed 100644 --- a/golem_season/models/golem_season.py +++ b/golem_season/models/golem_season.py @@ -54,6 +54,13 @@ class GolemSeason(models.Model): """ Check if end date if after start date and if there is no conflict with existing periods """ for season in self: + if season.date_start: + if not season.date_end: + raise models.ValidationError(_('The date end is required')) + if season.date_end: + if not season.date_start: + raise models.ValidationError(_('The date start is required')) + if season.date_start > season.date_end: raise models.ValidationError(_('Start of the period cannot be ' 'after end of the period.')) diff --git a/golem_season/views/golem_season_views.xml b/golem_season/views/golem_season_views.xml index 4d4d619..3ce8da0 100644 --- a/golem_season/views/golem_season_views.xml +++ b/golem_season/views/golem_season_views.xml @@ -37,8 +37,10 @@ along with this program. If not, see . - - + +