2017-04-23 07:19:38 +00:00
|
|
|
from . import models
|
2016-03-30 04:13:50 +00:00
|
|
|
|
|
|
|
from django import forms
|
|
|
|
|
2016-10-06 20:10:39 +00:00
|
|
|
|
|
|
|
class YesNoField(forms.TypedChoiceField):
|
|
|
|
|
2017-04-23 07:19:38 +00:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
kwargs['required'] = True
|
2016-10-06 20:10:39 +00:00
|
|
|
super(YesNoField, self).__init__(
|
2017-04-23 07:19:38 +00:00
|
|
|
*args,
|
|
|
|
coerce=lambda x: x == True,
|
|
|
|
choices=((None, '--------'), (False, 'No'), (True, 'Yes')),
|
|
|
|
**kwargs
|
2016-10-06 20:10:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
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']
|
2017-04-23 07:19:38 +00:00
|
|
|
widgets = {
|
|
|
|
'past_lca': forms.widgets.CheckboxSelectMultiple
|
|
|
|
}
|
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
|
|
|
}
|