2016-03-30 04:13:50 +00:00
|
|
|
import models
|
|
|
|
|
|
|
|
from django import forms
|
|
|
|
|
2016-10-06 20:10:39 +00:00
|
|
|
|
|
|
|
class YesNoField(forms.TypedChoiceField):
|
|
|
|
|
|
|
|
def __init__(self, *a, **k):
|
|
|
|
super(YesNoField, self).__init__(
|
|
|
|
*a,
|
2017-03-05 07:34:15 +00:00
|
|
|
coerce=lambda x: x == 'True',
|
2016-10-06 20:10:39 +00:00
|
|
|
choices=((False, 'No'), (True, 'Yes')),
|
|
|
|
widget=forms.RadioSelect,
|
|
|
|
**k
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2016-03-30 04:13:50 +00:00
|
|
|
class ProfileForm(forms.ModelForm):
|
|
|
|
''' A form for requesting badge and profile information. '''
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = models.AttendeeProfile
|
|
|
|
exclude = ['attendee']
|
2016-10-06 20:10:39 +00:00
|
|
|
field_classes = {
|
2017-03-05 07:34:15 +00:00
|
|
|
"of_legal_age": YesNoField,
|
2016-10-06 20:10:39 +00:00
|
|
|
}
|
2016-09-30 10:46:05 +00:00
|
|
|
widgets = {
|
2017-03-05 07:34:15 +00:00
|
|
|
"past_lca": forms.widgets.CheckboxSelectMultiple(),
|
2016-09-30 10:46:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class Media:
|
|
|
|
js = ("lca2017/js/profile_form.js", )
|