symposion_app/pinaxcon/registrasion/forms.py

32 lines
791 B
Python
Raw Normal View History

from pinaxcon.registrasion import models
from django import forms
2016-10-06 20:10:39 +00:00
class YesNoField(forms.TypedChoiceField):
def __init__(self, *args, **kwargs):
kwargs['required'] = True
2016-10-06 20:10:39 +00:00
super(YesNoField, self).__init__(
*args,
coerce=lambda x: x is True,
choices=((None, '--------'), (False, 'No'), (True, 'Yes')),
**kwargs
2016-10-06 20:10:39 +00:00
)
class ProfileForm(forms.ModelForm):
''' A form for requesting badge and profile information. '''
required_css_class = 'label-required'
class Meta:
model = models.AttendeeProfile
exclude = ['attendee']
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
}