import copy from django import forms from pinaxcon.proposals.fields import HelpTextField from pinaxcon.proposals import models DEFAULT_FIELDS = [ "title", # "primary_topic", "target_audience", "experience_level", "abstract", "private_abstract", # "content_warning", "technical_requirements", # "project", # "project_url", # "video_url", "require_approval", "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 = copy.copy(DEFAULT_FIELDS) class TutorialProposalForm(ProposalForm): class Meta: model = models.TutorialProposal fields = copy.copy(DEFAULT_FIELDS) class MiniconfProposalForm(ProposalForm): def __init__(self, *a, **k): super(MiniconfProposalForm, self).__init__(*a, **k) self.fields['ticket_acknowledgement'].required = True class CopyleftComplianceProposalForm(MiniconfProposalForm): class Meta: model = models.CopyleftComplianceProposal fields = TALK_FORMAT_FIELDS class MemberProjectProposalForm(MiniconfProposalForm): class Meta: model = models.MemberProjectProposal fields = TALK_FORMAT_FIELDS class ContainerDaysProposalForm(MiniconfProposalForm): class Meta: model = models.ContainerDaysProposal fields = TALK_FORMAT_FIELDS class SustainableOpenSourceBusinessProposalForm(MiniconfProposalForm): class Meta: model = models.SustainableOpenSourceBusinessProposal fields = TALK_FORMAT_FIELDS class SoftwareWorkerCoopsProposalForm(MiniconfProposalForm): class Meta: model = models.SoftwareWorkerCoopsProposal fields = TALK_FORMAT_FIELDS class DiversityEquityInclusionProposalForm(MiniconfProposalForm): class Meta: model = models.DiversityEquityInclusionProposal fields = TALK_FORMAT_FIELDS class FOSSAtPlayProposalForm(MiniconfProposalForm): class Meta: model = models.FOSSAtPlayProposal fields = TALK_FORMAT_FIELDS class OpenSourcAIDataProposalForm(MiniconfProposalForm): class Meta: model = models.OpenSourcAIDataProposal fields = TALK_FORMAT_FIELDS class OpenWorkProposalForm(MiniconfProposalForm): class Meta: model = models.OpenWorkProposal fields = TALK_FORMAT_FIELDS class CommunityProposalForm(MiniconfProposalForm): class Meta: model = models.CommunityProposal fields = TALK_FORMAT_FIELDS class BSDUnixProposalForm(MiniconfProposalForm): class Meta: model = models.BSDUnixProposal fields = TALK_FORMAT_FIELDS class XMPPProposalForm(MiniconfProposalForm): class Meta: model = models.XMPPProposal fields = TALK_FORMAT_FIELDS class ScienceOfCommunityProposalForm(MiniconfProposalForm): class Meta: model = models.ScienceOfCommunityProposal fields = TALK_FORMAT_FIELDS class AArch64ARM64ProposalForm(MiniconfProposalForm): class Meta: model = models.AArch64ARM64Proposal fields = TALK_FORMAT_FIELDS class FOSSForEducationProposalForm(MiniconfProposalForm): class Meta: model = models.FOSSForEducationProposal fields = TALK_FORMAT_FIELDS class FOSSInDailyLifeProposalForm(MiniconfProposalForm): class Meta: model = models.FOSSInDailyLifeProposal fields = TALK_FORMAT_FIELDS