forked from beba/foerderbarometer
validate checkin & checkout
This commit is contained in:
parent
9b1fb39d8c
commit
0bd7bb0672
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in New Issue