From 833eebc46ddbfc2b6a49f94711b1918a93232e40 Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Thu, 6 Oct 2016 13:10:39 -0700 Subject: [PATCH] Fixes presentation of the 18+ question --- pinaxcon/registrasion/forms.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pinaxcon/registrasion/forms.py b/pinaxcon/registrasion/forms.py index 8b501a0e..ce37ea05 100644 --- a/pinaxcon/registrasion/forms.py +++ b/pinaxcon/registrasion/forms.py @@ -2,15 +2,32 @@ import models from django import forms + +class YesNoField(forms.TypedChoiceField): + + def __init__(self, *a, **k): + super(YesNoField, self).__init__( + *a, + coerce=lambda x: x =='True', + choices=((False, 'No'), (True, 'Yes')), + widget=forms.RadioSelect, + **k + ) + + class ProfileForm(forms.ModelForm): ''' A form for requesting badge and profile information. ''' class Meta: model = models.AttendeeProfile exclude = ['attendee'] + field_classes = { + "of_legal_age" : YesNoField, + } widgets = { "past_lca" : forms.widgets.CheckboxSelectMultiple(), } + class Media: js = ("lca2017/js/profile_form.js", )