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
|
|
|
|
|
2018-10-12 01:17:17 +00:00
|
|
|
_MARKDOWN_CHEATSHEET_URL = 'https://www.markdownguide.org/cheat-sheet'
|
2017-08-13 19:31:22 +00:00
|
|
|
|
|
|
|
class ConferenceSpeakerForm(forms.ModelForm):
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = ConferenceSpeaker
|
|
|
|
exclude = [
|
|
|
|
'user',
|
|
|
|
'biography_html',
|
|
|
|
'experience_html',
|
|
|
|
'invite_email',
|
|
|
|
'invite_token',
|
|
|
|
'annotation',
|
2018-07-05 21:15:01 +00:00
|
|
|
'reviewer',
|
2018-10-05 20:46:10 +00:00
|
|
|
# Not happening for CopyleftConf 2019.
|
|
|
|
'travel_assistance',
|
|
|
|
'lodging_assistance',
|
2017-08-13 19:31:22 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
def __init__(self, *a, **k):
|
|
|
|
super(ConferenceSpeakerForm, self).__init__(*a, **k)
|
|
|
|
self.fields['code_of_conduct'].required = True
|
2018-10-12 01:17:17 +00:00
|
|
|
for field in ('biography', 'experience'):
|
|
|
|
self.fields[field].help_text = self.fields[field].help_text.replace(
|
|
|
|
'http://warpedvisions.org/projects/markdown-cheat-sheet/',
|
|
|
|
_MARKDOWN_CHEATSHEET_URL,
|
|
|
|
).replace(
|
|
|
|
# Fix a typo in Symposion model help text:
|
|
|
|
# <https://github.com/pinax/symposion/blob/8cb001b16946e2d98e8e45b59c2b506e51b52937/symposion/speakers/models.py#L28-L29>
|
|
|
|
"{}target=".format(_MARKDOWN_CHEATSHEET_URL),
|
|
|
|
"{}' target=".format(_MARKDOWN_CHEATSHEET_URL),
|
|
|
|
)
|
2017-08-13 19:31:22 +00:00
|
|
|
|
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()
|
2018-10-12 01:17:17 +00:00
|
|
|
self.fields["additional_notes"].help_text = """
|
|
|
|
Anything else you'd like the program committee to know when making their
|
|
|
|
selection. This is not made public. Edit using
|
|
|
|
<a href='{}' target='_blank'>Markdown</a>.""".format(_MARKDOWN_CHEATSHEET_URL)
|
|
|
|
self.fields["abstract"].help_text = """
|
|
|
|
Detailed abstract. Will be made public if your proposal is accepted.
|
|
|
|
Edit using
|
|
|
|
<a href='{}' target='_blank'>Markdown</a>.""".format(_MARKDOWN_CHEATSHEET_URL)
|
2017-08-20 01:36:51 +00:00
|
|
|
|
2017-08-22 19:25:10 +00:00
|
|
|
for field in ("description", "abstract", "additional_notes"):
|
|
|
|
self.fields[field].help_text += (" Please do not include "
|
|
|
|
"any information that could identify you, as your proposal "
|
|
|
|
"will be reviewed anonymously.")
|
|
|
|
|
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",
|
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",
|
|
|
|
]
|