fix: validate dates only if starts_on and ends_on
This commit is contained in:
parent
421e4eebeb
commit
cabb3f314b
1 changed files with 2 additions and 1 deletions
|
|
@ -22,7 +22,8 @@ class Event(Document):
|
|||
if not self.starts_on:
|
||||
self.starts_on = now_datetime()
|
||||
|
||||
self.validate_from_to_dates("starts_on", "ends_on")
|
||||
if self.starts_on and self.ends_on:
|
||||
self.validate_from_to_dates("starts_on", "ends_on")
|
||||
|
||||
# if start == end this scenario doesn't make sense i.e. it starts and ends at the same second!
|
||||
self.ends_on = None if self.starts_on == self.ends_on else self.ends_on
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue