symposion_app/vendor/symposion/speakers/forms.py
Sachi King d95d66dac8 Taking one out of PyCon's (US) book
We're lock-step with symposion, and upstream is dead.
Vendor it.
2017-05-27 20:11:39 +10:00

32 lines
762 B
Python

from django import forms
from symposion.speakers.models import Speaker
class SpeakerForm(forms.ModelForm):
required_css_class = 'label-required'
class Meta:
model = Speaker
fields = [
"name",
"biography",
"experience",
"photo",
"telephone",
"homepage",
"twitter_username",
"accessibility",
"agreement",
]
def __init__(self, *a, **k):
super(SpeakerForm, self).__init__(*a, **k)
self.fields['agreement'].required = True
def clean_twitter_username(self):
value = self.cleaned_data["twitter_username"]
if value.startswith("@"):
value = value[1:]
return value