mirror of https://gitlab.crans.org/bde/nk20
Ensure some values exist before updating them
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
132afc3d15
commit
546e422e64
|
@ -264,8 +264,10 @@ class Club(models.Model):
|
||||||
today = datetime.date.today()
|
today = datetime.date.today()
|
||||||
|
|
||||||
if (today - self.membership_start).days >= 365:
|
if (today - self.membership_start).days >= 365:
|
||||||
|
if self.membership_start:
|
||||||
self.membership_start = datetime.date(self.membership_start.year + 1,
|
self.membership_start = datetime.date(self.membership_start.year + 1,
|
||||||
self.membership_start.month, self.membership_start.day)
|
self.membership_start.month, self.membership_start.day)
|
||||||
|
if self.membership_end:
|
||||||
self.membership_end = datetime.date(self.membership_end.year + 1,
|
self.membership_end = datetime.date(self.membership_end.year + 1,
|
||||||
self.membership_end.month, self.membership_end.day)
|
self.membership_end.month, self.membership_end.day)
|
||||||
self._force_save = True
|
self._force_save = True
|
||||||
|
|
Loading…
Reference in New Issue