Skip to content
Snippets Groups Projects
Commit 9c44eb4e authored by Thijs de Jong's avatar Thijs de Jong
Browse files

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

Fix valid property output to always be an boolean

See merge request !1398
parents da49820e 8c1414da
No related branches found
No related tags found
1 merge request!1398Fix valid property output to always be an boolean
......@@ -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}'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment