adds method to return the club of the last event

bracket-feature
Laurent 10 months ago
parent 7830c5ffcf
commit 5bea1c28e6
  1. 6
      tournaments/models/custom_user.py

@ -56,3 +56,9 @@ class CustomUser(AbstractUser):
def full_name(self):
return f"{self.first_name} {self.last_name}"
def latest_event_club_name(self):
latest_event = self.event_set.order_by('-creation_date').first()
if latest_event and latest_event.club:
return latest_event.club.name
return None

Loading…
Cancel
Save