Skip to content

Commit

Permalink
in registration form, hide alternate choice once the season has started
Browse files Browse the repository at this point in the history
  • Loading branch information
glbert-does committed Jan 6, 2025
1 parent e119308 commit ff0bff7
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions heltour/tournament/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,20 @@ def __init__(self, *args, **kwargs):

# Alternate preference
if league.competitor_type == 'team':
self.fields['alternate_preference'] = forms.ChoiceField(required=True,
choices=ALTERNATE_PREFERENCE_OPTIONS,
widget=forms.RadioSelect,
label=_(
'Are you interested in being an alternate or a full time player?'),
help_text=_(
'Players are put into teams on a first come first served basis, based on registration date. \
You may be an alternate even if you request to be a full time player.'))
if self.season.is_started():
self.fields['alternate_preference'] = forms.ChoiceField(required=False,
choices=ALTERNATE_PREFERENCE_OPTIONS,
initial='full_time',
widget=forms.HiddenInput())
else:
self.fields['alternate_preference'] = forms.ChoiceField(required=True,
choices=ALTERNATE_PREFERENCE_OPTIONS,
widget=forms.RadioSelect,
label=_(
'Are you interested in being an alternate or a full time player?'),
help_text=_(
'Players are put into teams on a first come first served basis, based on registration date. \
You may be an alternate even if you request to be a full time player.'))
else:
del self.fields['alternate_preference']

Expand Down

0 comments on commit ff0bff7

Please sign in to comment.