Files @ 59207eb0c971
Branch filter:

Location: symposion_app/pinaxcon/registrasion/forms.py

Jamie Lennox
Other suggested django migrations

So django keeps strict synchronization between its code and migrations
so that it can help generating new migrations. These are the additional
suggested migrations. A lot of these are a null effect, some are things
like transforming an unsigned integer to a signed integer. So not super
urgent on a small scale, but worth doing to keep django happy.
from pinaxcon.registrasion import models

from django import forms


class YesNoField(forms.TypedChoiceField):

    def __init__(self, *args, **kwargs):
        kwargs['required'] = True
        super(YesNoField, self).__init__(
            *args,
            coerce=lambda x: x is True,
            choices=((None, '--------'), (False, 'No'), (True, 'Yes')),
            **kwargs
        )


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
        }
        field_classes = {
            "of_legal_age": YesNoField,
        }