symposion_app/vendor/symposion/speakers/forms.py

41 lines
1.5 KiB
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",
"pronouns",
"biography",
"experience",
"photo",
"telephone",
# "local_timezone",
"homepage",
"twitter_username",
"mastodon_username",
"accessibility",
# "travel_assistance",
# "accommodation_assistance",
# "assistance",
"agreement",
]
def __init__(self, *a, **k):
super(SpeakerForm, self).__init__(*a, **k)
self.fields['agreement'].required = True
self.fields['agreement'].help_text = 'I agree to the <a href="/attend/terms-and-conditions/">Terms and Conditions</a>, and I have read, understood, and agree to act according to the standards set forth in our <a href="/attend/code-of-conduct/">Code of Conduct</a>.<br>I agree to the <a href="/attend/health-and-safety/">Health and Safety Guidelines</a>, in particular the <strong>requirement to wear a mask</strong> at this event.'
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