Commit 4d75876c authored by Michal Čihař's avatar Michal Čihař

Do not check if partial validation has failed

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent ca92a747
......@@ -165,8 +165,15 @@ class Invoice(models.Model):
return '{0} - {1}: {2}'.format(self.start, self.end, self.billing)
def clean(self):
if self.end is None or self.start is None:
return
if self.end <= self.start:
raise ValidationError('Start has be to before end!')
if self.billing is None:
return
overlapping = Invoice.objects.filter(
(Q(start__lte=self.end) & Q(end__gte=self.end)) |
(Q(start__lte=self.start) & Q(end__gte=self.start))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment