diff --git a/input/models.py b/input/models.py index 82587b7..e7cedf7 100755 --- a/input/models.py +++ b/input/models.py @@ -387,6 +387,14 @@ class Travel(Extern): # use content type model to get the end date for the project foreign key project_end_quartal = models.CharField(max_length=15, null=True, blank=True, verbose_name='Quartal Projekt Ende') + def clean(self): + if (self.checkin and self.checkout) and (self.checkout < self.checkin): + raise forms.ValidationError({ + 'checkout': [ + forms.ValidationError('Das Datum der Abreise muss nach dem Datum der Anreise liegen.'), + ], + }) + @receiver(pre_save, sender=Travel, dispatch_uid='get_project_end') def get_project_end(sender, instance, **kwargs):