2015-10-16 17:53:02 +00:00
|
|
|
from django import forms
|
|
|
|
|
2016-06-29 13:17:15 +00:00
|
|
|
from pinaxcon import widgets
|
|
|
|
|
2016-06-21 11:47:45 +00:00
|
|
|
from .models import TalkProposal, TutorialProposal, MiniconfProposal
|
2015-10-16 17:53:02 +00:00
|
|
|
|
2017-03-05 07:34:15 +00:00
|
|
|
|
2015-10-16 17:53:02 +00:00
|
|
|
class ProposalForm(forms.ModelForm):
|
|
|
|
|
|
|
|
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",
|
2016-06-20 23:58:27 +00:00
|
|
|
"target_audience",
|
2015-10-16 17:53:02 +00:00
|
|
|
"abstract",
|
2016-06-20 23:58:27 +00:00
|
|
|
"private_abstract",
|
|
|
|
"technical_requirements",
|
|
|
|
"project",
|
|
|
|
"project_url",
|
|
|
|
"video_url",
|
2015-10-16 17:53:02 +00:00
|
|
|
"recording_release",
|
2016-06-20 23:58:27 +00:00
|
|
|
"materials_release",
|
2015-10-16 17:53:02 +00:00
|
|
|
]
|
2016-06-21 11:47:45 +00:00
|
|
|
|
2016-06-29 13:17:15 +00:00
|
|
|
widgets = {
|
2017-03-05 07:34:15 +00:00
|
|
|
"abstract": widgets.AceMarkdownEditor(),
|
|
|
|
"private_abstract": widgets.AceMarkdownEditor(),
|
|
|
|
"technical_requirements": widgets.AceMarkdownEditor(),
|
2016-06-29 13:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-06-21 11:47:45 +00:00
|
|
|
class TutorialProposalForm(ProposalForm):
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = TutorialProposal
|
|
|
|
fields = [
|
|
|
|
"title",
|
|
|
|
"target_audience",
|
|
|
|
"abstract",
|
|
|
|
"private_abstract",
|
|
|
|
"technical_requirements",
|
|
|
|
"project",
|
|
|
|
"project_url",
|
|
|
|
"video_url",
|
|
|
|
"recording_release",
|
|
|
|
"materials_release",
|
|
|
|
]
|
|
|
|
|
2016-06-29 13:17:15 +00:00
|
|
|
widgets = {
|
2017-03-05 07:34:15 +00:00
|
|
|
"abstract": widgets.AceMarkdownEditor(),
|
|
|
|
"private_abstract": widgets.AceMarkdownEditor(),
|
|
|
|
"technical_requirements": widgets.AceMarkdownEditor(),
|
2016-06-29 13:17:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-06-21 11:47:45 +00:00
|
|
|
class MiniconfProposalForm(ProposalForm):
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = MiniconfProposal
|
|
|
|
fields = [
|
|
|
|
"title",
|
|
|
|
"abstract",
|
|
|
|
"private_abstract",
|
|
|
|
"technical_requirements",
|
|
|
|
]
|
2016-06-29 13:17:15 +00:00
|
|
|
|
|
|
|
widgets = {
|
2017-03-05 07:34:15 +00:00
|
|
|
"abstract": widgets.AceMarkdownEditor(),
|
|
|
|
"private_abstract": widgets.AceMarkdownEditor(),
|
|
|
|
"technical_requirements": widgets.AceMarkdownEditor(),
|
2016-06-29 13:17:15 +00:00
|
|
|
}
|