b9510fed67
I'm not against putting this back, however, it doesn't work quite as one would expect, so I'm removing it as its functionality is more confusing that working. Is this really the best way to address this? If you unselect AU, then it never comes back. It leaves its value in the textbox pre-filled if it ever got a value, leaving the field pre-filled with an Aus state even if the person is New Zealand. Most of our attendees are from but a few countries, we should make these equal effort to fill in.
29 lines
728 B
Python
29 lines
728 B
Python
from . import models
|
|
|
|
from django import forms
|
|
|
|
|
|
class YesNoField(forms.TypedChoiceField):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
kwargs['required'] = True
|
|
super(YesNoField, self).__init__(
|
|
*args,
|
|
coerce=lambda x: x == True,
|
|
choices=((None, '--------'), (False, 'No'), (True, 'Yes')),
|
|
**kwargs
|
|
)
|
|
|
|
|
|
class ProfileForm(forms.ModelForm):
|
|
''' A form for requesting badge and profile information. '''
|
|
|
|
class Meta:
|
|
model = models.AttendeeProfile
|
|
exclude = ['attendee']
|
|
widgets = {
|
|
'past_lca': forms.widgets.CheckboxSelectMultiple
|
|
}
|
|
field_classes = {
|
|
"of_legal_age": YesNoField,
|
|
}
|