2012-07-12 00:38:24 -04:00
|
|
|
from django import forms
|
|
|
|
|
|
|
|
from symposion.speakers.models import Speaker
|
|
|
|
|
|
|
|
|
|
|
|
class SpeakerForm(forms.ModelForm):
|
2014-07-30 15:19:26 -03:00
|
|
|
|
2017-04-24 22:50:48 +10:00
|
|
|
required_css_class = 'label-required'
|
|
|
|
|
2012-07-12 00:38:24 -04:00
|
|
|
class Meta:
|
|
|
|
model = Speaker
|
|
|
|
fields = [
|
|
|
|
"name",
|
|
|
|
"biography",
|
2016-06-19 13:19:32 +10:00
|
|
|
"experience",
|
2012-07-12 00:38:24 -04:00
|
|
|
"photo",
|
2016-06-19 13:19:32 +10:00
|
|
|
"telephone",
|
|
|
|
"homepage",
|
2016-03-14 22:24:14 -05:00
|
|
|
"twitter_username",
|
2016-06-18 13:53:02 +10:00
|
|
|
"accessibility",
|
2017-07-16 00:21:10 +10:00
|
|
|
"travel_assistance",
|
|
|
|
"accommodation_assistance",
|
2016-06-19 14:00:17 +10:00
|
|
|
"agreement",
|
2012-07-12 00:38:24 -04:00
|
|
|
]
|
2016-03-14 22:24:14 -05:00
|
|
|
|
2016-06-19 14:00:17 +10:00
|
|
|
def __init__(self, *a, **k):
|
|
|
|
super(SpeakerForm, self).__init__(*a, **k)
|
|
|
|
self.fields['agreement'].required = True
|
|
|
|
|
2016-03-14 22:24:14 -05:00
|
|
|
def clean_twitter_username(self):
|
|
|
|
value = self.cleaned_data["twitter_username"]
|
|
|
|
if value.startswith("@"):
|
|
|
|
value = value[1:]
|
|
|
|
return value
|