mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-20 21:39:37 +02:00
Remove redundant validation checks in Adventure model
This commit is contained in:
parent
bde33260fa
commit
adb92a1d41
1 changed files with 0 additions and 4 deletions
|
@ -90,10 +90,6 @@ class Adventure(models.Model):
|
||||||
# end_date = models.DateField(blank=True, null=True)
|
# end_date = models.DateField(blank=True, null=True)
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
if self.date and self.end_date and self.date > self.end_date:
|
|
||||||
raise ValidationError('The start date must be before the end date. Start date: ' + str(self.date) + ' End date: ' + str(self.end_date))
|
|
||||||
if self.end_date and not self.date:
|
|
||||||
raise ValidationError('Adventures must have an end date. Adventure: ' + self.name)
|
|
||||||
if self.collection:
|
if self.collection:
|
||||||
if self.collection.is_public and not self.is_public:
|
if self.collection.is_public and not self.is_public:
|
||||||
raise ValidationError('Adventures associated with a public collection must be public. Collection: ' + self.trip.name + ' Adventure: ' + self.name)
|
raise ValidationError('Adventures associated with a public collection must be public. Collection: ' + self.trip.name + ' Adventure: ' + self.name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue