Commit 9c44eb4e authored by Thijs de Jong's avatar Thijs de Jong

Merge branch 'valid-property-none' into 'master'

Fix valid property output to always be an boolean

See merge request !1398
parents da49820e 8c1414da
......@@ -219,9 +219,10 @@ class BankAccount(models.Model):
@property
def valid(self):
if self.valid_from and self.valid_until:
if self.valid_from is not None and self.valid_until is not None:
return self.valid_from <= timezone.now().date() < self.valid_until
return self.valid_from and self.valid_from <= timezone.now().date()
return (self.valid_from is not None
and self.valid_from <= timezone.now().date())
def __str__(self):
return f'{self.iban} - {self.name}'
......
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