symposion_app/vendor/symposion/speakers/forms.py

41 lines
1 KiB
Python
Raw Normal View History

2012-07-12 04:38:24 +00:00
from django import forms
from symposion.speakers.models import Speaker
class SpeakerForm(forms.ModelForm):
2014-07-30 18:19:26 +00:00
required_css_class = 'label-required'
2012-07-12 04:38:24 +00:00
class Meta:
model = Speaker
fields = [
"name",
2022-12-07 14:08:54 +00:00
"pronouns",
2012-07-12 04:38:24 +00:00
"biography",
"experience",
2012-07-12 04:38:24 +00:00
"photo",
2022-12-07 14:08:54 +00:00
"telephone",
# "local_timezone",
"homepage",
"twitter_username",
2022-12-07 14:08:54 +00:00
"mastodon_username",
"accessibility",
# "travel_assistance",
# "accommodation_assistance",
# "assistance",
"agreement",
2012-07-12 04:38:24 +00:00
]
def __init__(self, *a, **k):
super(SpeakerForm, self).__init__(*a, **k)
self.fields['agreement'].required = True
2020-10-05 12:13:28 +00:00
self.fields['biography'].required = True
# self.fields['local_timezone'].required = True
def clean_twitter_username(self):
value = self.cleaned_data["twitter_username"]
if value.startswith("@"):
value = value[1:]
return value