2015-10-16 17:53:02 +00:00
|
|
|
from django import forms
|
2017-08-13 19:52:57 +00:00
|
|
|
from symposion.proposals.forms import ProposalMixIn
|
2015-10-16 17:53:02 +00:00
|
|
|
|
2017-08-13 19:31:22 +00:00
|
|
|
from .models import ConferenceSpeaker, TalkProposal
|
|
|
|
|
|
|
|
|
|
|
|
class ConferenceSpeakerForm(forms.ModelForm):
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = ConferenceSpeaker
|
|
|
|
exclude = [
|
|
|
|
'user',
|
|
|
|
'biography_html',
|
|
|
|
'experience_html',
|
|
|
|
'invite_email',
|
|
|
|
'invite_token',
|
|
|
|
'annotation',
|
|
|
|
]
|
|
|
|
|
|
|
|
def __init__(self, *a, **k):
|
|
|
|
super(ConferenceSpeakerForm, self).__init__(*a, **k)
|
|
|
|
self.fields['code_of_conduct'].required = True
|
|
|
|
|
2015-10-16 17:53:02 +00:00
|
|
|
|
|
|
|
|
2017-08-13 19:52:57 +00:00
|
|
|
class ProposalForm(forms.ModelForm, ProposalMixIn):
|
|
|
|
|
|
|
|
def __init__(self, *a, **k):
|
|
|
|
super(ProposalForm, self).__init__(*a, **k)
|
|
|
|
self.description_required()
|
|
|
|
self.abstract_required()
|
2015-10-16 17:53:02 +00:00
|
|
|
|
|
|
|
def clean_description(self):
|
|
|
|
value = self.cleaned_data["description"]
|
|
|
|
if len(value) > 400:
|
|
|
|
raise forms.ValidationError(
|
|
|
|
u"The description must be less than 400 characters"
|
|
|
|
)
|
|
|
|
return value
|
|
|
|
|
|
|
|
|
|
|
|
class TalkProposalForm(ProposalForm):
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = TalkProposal
|
|
|
|
fields = [
|
|
|
|
"title",
|
|
|
|
"description",
|
|
|
|
"abstract",
|
2017-08-13 19:52:57 +00:00
|
|
|
"new_presentation",
|
|
|
|
"extended_presentation",
|
2015-10-16 17:53:02 +00:00
|
|
|
"additional_notes",
|
2017-08-13 19:52:57 +00:00
|
|
|
"extra_av",
|
|
|
|
"slides_release",
|
2015-10-16 17:53:02 +00:00
|
|
|
"recording_release",
|
|
|
|
]
|