symposion_app/pinaxcon/proposals/forms.py
Joel Addison f72490b1eb LCA2022 Setup
Update dates and descriptions for LCA2022.
Remove old miniconf proposal types.
Add local timezone to speaker profile.
2021-07-05 20:20:24 +10:00

72 lines
1.7 KiB
Python

import copy
from django import forms
from pinaxcon.proposals.fields import HelpTextField
from pinaxcon.proposals import models
DEFAULT_FIELDS = [
"title",
"target_audience",
"abstract",
"private_abstract",
"technical_requirements",
"project",
"project_url",
"video_url",
"recording_release",
"materials_release",
]
MINICONF_SESSION_FORMAT_FIELDS = copy.copy(DEFAULT_FIELDS)
MINICONF_SESSION_FORMAT_FIELDS.insert(2, "talk_format")
MINICONF_SESSION_FORMAT_FIELDS.append("ticket_acknowledgement")
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 = models.TalkProposal
fields = copy.copy(DEFAULT_FIELDS)
class TutorialProposalForm(ProposalForm):
class Meta:
model = models.TutorialProposal
fields = copy.copy(DEFAULT_FIELDS)
class MiniconfProposalForm(ProposalForm):
class Meta:
model = models.MiniconfProposal
fields = [
"title",
"abstract",
"private_abstract",
"technical_requirements",
"recording_release",
"materials_release",
]
### LCA2022 Miniconfs
class MiniconfSessionProposalForm(ProposalForm):
def __init__(self, *a, **k):
super(MiniconfSessionProposalForm, self).__init__(*a, **k)
self.fields['ticket_acknowledgement'].required = True