|
|
|
|
@ -1,4 +1,5 @@ |
|
|
|
|
from django.db import models |
|
|
|
|
from django.apps import apps |
|
|
|
|
from django.contrib.auth.models import AbstractUser |
|
|
|
|
from . import club, enums |
|
|
|
|
import uuid |
|
|
|
|
@ -63,4 +64,12 @@ class CustomUser(AbstractUser): |
|
|
|
|
latest_event = self.event_set.order_by('-creation_date').first() |
|
|
|
|
if latest_event and latest_event.club: |
|
|
|
|
return latest_event.club.name |
|
|
|
|
if self.licence_id: |
|
|
|
|
PlayerRegistration = apps.get_model('tournaments', 'PlayerRegistration') |
|
|
|
|
player_registration = PlayerRegistration.objects.filter(licence_id=self.licence_id).order_by('team_registration__registration_date').first() |
|
|
|
|
try: |
|
|
|
|
return player_registration.team_registration.tournament.event.club.name |
|
|
|
|
except AttributeError: |
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
return None |
|
|
|
|
|