symposion_app/pinaxcon/proposals/forms.py
Joel Addison 246bbcb324 Add LCA2020 Miniconfs
Setup proposals for miniconfs, including model, forms and admin.
2019-09-29 20:04:39 +10:00

178 lines
3.8 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",
"recording_release",
"materials_release",
]
TALK_FORMAT_FIELDS = copy.copy(DEFAULT_FIELDS)
TALK_FORMAT_FIELDS.insert(2, "talk_format")
TALK_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 = [
"title",
"target_audience",
"abstract",
"private_abstract",
"technical_requirements",
"project",
"project_url",
"video_url",
"recording_release",
"materials_release",
]
class TutorialProposalForm(ProposalForm):
class Meta:
model = models.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 = models.MiniconfProposal
fields = [
"title",
"abstract",
"private_abstract",
"technical_requirements",
"recording_release",
"materials_release",
]
### LCA2020 Miniconfs
class MiniconfProposalForm(ProposalForm):
def __init__(self, *a, **k):
super(MiniconfProposalForm, self).__init__(*a, **k)
self.fields['ticket_acknowledgement'].required = True
class ContainersProposalForm(MiniconfProposalForm):
class Meta:
model = models.ContainersProposal
fields = TALK_FORMAT_FIELDS
class CreativeArtsProposalForm(MiniconfProposalForm):
class Meta:
model = models.CreativeArtsProposal
fields = TALK_FORMAT_FIELDS
class DocsProposalForm(MiniconfProposalForm):
class Meta:
model = models.DocsProposal
fields = TALK_FORMAT_FIELDS
class FreeBsdProposalForm(MiniconfProposalForm):
class Meta:
model = models.FreeBsdProposal
fields = TALK_FORMAT_FIELDS
class GamesProposalForm(MiniconfProposalForm):
class Meta:
model = models.GamesProposal
fields = TALK_FORMAT_FIELDS
class GlamProposalForm(MiniconfProposalForm):
class Meta:
model = models.GlamProposal
fields = TALK_FORMAT_FIELDS
class KernelProposalForm(MiniconfProposalForm):
class Meta:
model = models.KernelProposal
fields = TALK_FORMAT_FIELDS
class OpenEducationProposalForm(MiniconfProposalForm):
class Meta:
model = models.OpenEducationProposal
fields = TALK_FORMAT_FIELDS
class OpenHardwareProposalForm(MiniconfProposalForm):
class Meta:
model = models.OpenHardwareProposal
fields = TALK_FORMAT_FIELDS
class OpenIsaProposalForm(MiniconfProposalForm):
class Meta:
model = models.OpenIsaProposal
fields = TALK_FORMAT_FIELDS
class SecurityProposalForm(MiniconfProposalForm):
class Meta:
model = models.SecurityProposal
fields = TALK_FORMAT_FIELDS
class SysAdminProposalForm(MiniconfProposalForm):
class Meta:
model = models.SysAdminProposal
fields = TALK_FORMAT_FIELDS