2017-04-29 04:28:48 +00:00
|
|
|
from pinaxcon.registrasion 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,
|
2017-09-30 08:11:05 +00:00
|
|
|
coerce=lambda x: x in ['True', 'Yes', True],
|
2017-04-23 07:19:38 +00:00
|
|
|
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. '''
|
|
|
|
|
2017-04-24 13:10:51 +00:00
|
|
|
required_css_class = 'label-required'
|
|
|
|
|
2016-03-30 04:13:50 +00:00
|
|
|
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
|
|
|
}
|