symposion_app/symposion/speakers/forms.py
Sachi King 21b2a01a84 Py2 compatability has been broke elsewhere drop it
This is all noop in Py3, and Py2 is broke now in various places.
Dropping Py2 code as it will not be a thing going forward.

Django 2 is the next release, Py2 support will be dropped, as such,
dropping this is forward looking.
2017-04-29 15:47:19 +10:00

30 lines
719 B
Python

from django import forms
from symposion.speakers.models import Speaker
class SpeakerForm(forms.ModelForm):
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