Files @ 3ffa5fab60de
Branch filter:

Location: symposion_app/pinaxcon/registrasion/forms.py

James Polley
Don't require login to view qrcode

* The qrcode contains no information that isn't in the URL you used to
access the code, so information is being leaked
* Allowing unauthenicated access lets people see the image in their
mail client

Not ideal. Let's revert this later and think of something better next
year - perhaps spending some more time researching best practices on
images in email..
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']
        widgets = {
            'past_lca': forms.widgets.CheckboxSelectMultiple
        }
        field_classes = {
            "of_legal_age": YesNoField,
        }