2017-04-29 14:28:48 +10:00
|
|
|
from pinaxcon.registrasion import models
|
2016-03-30 15:13:50 +11:00
|
|
|
|
|
|
|
from django import forms
|
|
|
|
|
2016-10-06 13:10:39 -07:00
|
|
|
|
|
|
|
class YesNoField(forms.TypedChoiceField):
|
|
|
|
|
2017-04-23 17:19:38 +10:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
kwargs['required'] = True
|
2016-10-06 13:10:39 -07:00
|
|
|
super(YesNoField, self).__init__(
|
2017-04-23 17:19:38 +10:00
|
|
|
*args,
|
2017-09-30 18:11:05 +10:00
|
|
|
coerce=lambda x: x in ['True', 'Yes', True],
|
2017-04-23 17:19:38 +10:00
|
|
|
choices=((None, '--------'), (False, 'No'), (True, 'Yes')),
|
|
|
|
**kwargs
|
2016-10-06 13:10:39 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2016-03-30 15:13:50 +11:00
|
|
|
class ProfileForm(forms.ModelForm):
|
|
|
|
''' A form for requesting badge and profile information. '''
|
|
|
|
|
2017-04-24 23:10:51 +10:00
|
|
|
required_css_class = 'label-required'
|
|
|
|
|
2016-03-30 15:13:50 +11:00
|
|
|
class Meta:
|
|
|
|
model = models.AttendeeProfile
|
|
|
|
exclude = ['attendee']
|
2017-04-23 17:19:38 +10:00
|
|
|
widgets = {
|
|
|
|
'past_lca': forms.widgets.CheckboxSelectMultiple
|
|
|
|
}
|
2016-10-06 13:10:39 -07:00
|
|
|
field_classes = {
|
2017-03-05 18:34:15 +11:00
|
|
|
"of_legal_age": YesNoField,
|
2016-10-06 13:10:39 -07:00
|
|
|
}
|