symposion_app/pinaxcon/proposals/forms.py

85 lines
1.9 KiB
Python
Raw Normal View History

import copy
from django import forms
2018-10-05 19:43:50 +00:00
from pinaxcon.proposals.fields import HelpTextField
from pinaxcon.proposals.models import TalkProposal, TutorialProposal, MiniconfProposal
2018-10-01 02:09:33 +00:00
DEFAULT_FIELDS = [
"title",
"target_audience",
"abstract",
"private_abstract",
"technical_requirements",
"project",
"project_url",
"recording_release",
"materials_release",
]
TALK_FORMAT_FIELDS = copy.copy(DEFAULT_FIELDS)
2018-09-30 04:04:28 +00:00
TALK_FORMAT_FIELDS.insert(2, "talk_format")
2017-03-05 07:34:15 +00:00
class ProposalForm(forms.ModelForm):
required_css_class = 'label-required'
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",
"target_audience",
"abstract",
"private_abstract",
"technical_requirements",
"project",
"project_url",
"video_url",
"recording_release",
"materials_release",
]
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",
]
class MiniconfProposalForm(ProposalForm):
class Meta:
model = MiniconfProposal
fields = [
"title",
"abstract",
"private_abstract",
"technical_requirements",
"recording_release",
"materials_release",
]