symposion_app/pinaxcon/registrasion/forms.py

38 lines
940 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 in ['True', 'Yes', 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',
'children',
2022-12-07 14:08:54 +00:00
'lca_announce',
2021-11-27 06:36:16 +00:00
'lca_chat',
'future_conference',
]
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
}