|
|
|
@ -619,7 +619,10 @@ def register_tournament(request, tournament_id): |
|
|
|
|
|
|
|
|
|
|
|
validator = LicenseValidator(licence_id) |
|
|
|
validator = LicenseValidator(licence_id) |
|
|
|
if validator.validate_license() is False and tournament.license_is_required is True: |
|
|
|
if validator.validate_license() is False and tournament.license_is_required is True: |
|
|
|
messages.error(request, f"Le numéro de licence est invalide, la lettre ne correspond pas. {validator.computed_license_key}") |
|
|
|
if len(licence_id) == 0: |
|
|
|
|
|
|
|
messages.error(request, f"Le numéro de licence est obligatoire.") |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
messages.error(request, f"Le numéro de licence est invalide, la lettre ne correspond pas.") |
|
|
|
return render(request, 'register_tournament.html', { |
|
|
|
return render(request, 'register_tournament.html', { |
|
|
|
'team_form': team_form, |
|
|
|
'team_form': team_form, |
|
|
|
'add_player_form': add_player_form, |
|
|
|
'add_player_form': add_player_form, |
|
|
|
@ -691,6 +694,20 @@ def register_tournament(request, tournament_id): |
|
|
|
request.session['is_woman'] = data['is_woman'] |
|
|
|
request.session['is_woman'] = data['is_woman'] |
|
|
|
request.session.modified = True # Ensure session is updated |
|
|
|
request.session.modified = True # Ensure session is updated |
|
|
|
add_player_form.first_tournament = True |
|
|
|
add_player_form.first_tournament = True |
|
|
|
|
|
|
|
if add_player_form.names_is_valid() is False: |
|
|
|
|
|
|
|
if len(request.session.get('team_registration', [])) == 0: |
|
|
|
|
|
|
|
messages.error(request, "Pour confirmer votre inscription votre prénom et votre nom sont obligatoires.") |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
messages.error(request, "Pour rajouter un partenaire, son prénom et son nom sont obligatoires.") |
|
|
|
|
|
|
|
return render(request, 'register_tournament.html', { |
|
|
|
|
|
|
|
'team_form': team_form, |
|
|
|
|
|
|
|
'add_player_form': add_player_form, |
|
|
|
|
|
|
|
'tournament': tournament, |
|
|
|
|
|
|
|
'registration_successful': registration_successful, |
|
|
|
|
|
|
|
'current_players': request.session['team_registration'], |
|
|
|
|
|
|
|
'user_without_licence': user_without_licence |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|