|
|
|
@ -1,8 +1,7 @@ |
|
|
|
from django.contrib import messages |
|
|
|
from django.contrib import messages |
|
|
|
from django.utils import timezone |
|
|
|
from django.utils import timezone |
|
|
|
from ..models import PlayerRegistration, UnregisteredTeam, UnregisteredPlayer |
|
|
|
from ..models import PlayerRegistration, UnregisteredTeam, UnregisteredPlayer |
|
|
|
from ..models.player_enums import PlayerDataSource |
|
|
|
from ..utils.licence_validator import LicenseValidator |
|
|
|
from ..services.email_service import TournamentEmailService |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TournamentUnregistrationService: |
|
|
|
class TournamentUnregistrationService: |
|
|
|
def __init__(self, request, tournament): |
|
|
|
def __init__(self, request, tournament): |
|
|
|
@ -52,8 +51,16 @@ class TournamentUnregistrationService: |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
def _find_player_registration(self): |
|
|
|
def _find_player_registration(self): |
|
|
|
|
|
|
|
if not self.request.user.licence_id: |
|
|
|
|
|
|
|
return False |
|
|
|
|
|
|
|
validator = LicenseValidator(self.request.user.licence_id) |
|
|
|
|
|
|
|
is_license_valid = validator.validate_license() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not is_license_valid: |
|
|
|
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
self.player_registration = PlayerRegistration.objects.filter( |
|
|
|
self.player_registration = PlayerRegistration.objects.filter( |
|
|
|
licence_id__icontains=self.request.user.licence_id, |
|
|
|
licence_id__icontains=validator.stripped_license, |
|
|
|
team_registration__tournament_id=self.tournament.id, |
|
|
|
team_registration__tournament_id=self.tournament.id, |
|
|
|
).first() |
|
|
|
).first() |
|
|
|
|
|
|
|
|
|
|
|
|