Files @ 34509d23eb9f
Branch filter:

Location: symposion_app/pinaxcon/registrasion/forms.py

bsturmfels
Make vendored symposion into an installable Python package

This allows us to install with `pip install "-e vendor/symposion"` similar to
the other vendored packages. There's no good reason for this to be different to
the others and depend on PYTHONPATH hacking.

Re-add
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 in ['True', 'Yes', 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',
            'children',
            'lca_announce',
            'lca_chat',
            'future_conference',
            'linux_australia',
            'past_lca',
        ]
        widgets = {
            'past_lca': forms.widgets.CheckboxSelectMultiple
        }
        field_classes = {
            "of_legal_age": YesNoField,
        }