1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 18:08:21 +02:00

Fix memberships with clubs without memberships (we always need treasurers...)

This commit is contained in:
Yohann D'ANELLO
2020-04-01 04:34:42 +02:00
parent 535c493bc7
commit 92ab5ee3af
2 changed files with 8 additions and 5 deletions

View File

@ -128,6 +128,9 @@ class Club(models.Model):
This function is called each time the club detail view is displayed.
Update the year of the membership dates.
"""
if not self.membership_start:
return
today = datetime.date.today()
if (today - self.membership_start).days >= 365:
@ -237,7 +240,7 @@ class Membership(models.Model):
if self.club.membership_duration is not None:
self.date_end = self.date_start + datetime.timedelta(days=self.club.membership_duration)
else:
self.date_end = self.date_start + datetime.timedelta(days=0x7FFFFFFF)
self.date_end = self.date_start + datetime.timedelta(days=424242)
if self.club.membership_end is not None and self.date_end > self.club.membership_end:
self.date_end = self.club.membership_end