symposion_app/pinaxcon/proposals/forms.py

51 lines
1 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 import models
2018-10-01 02:09:33 +00:00
DEFAULT_FIELDS = [
"title",
2021-08-09 11:12:43 +00:00
"primary_topic",
"target_audience",
2021-08-09 11:12:43 +00:00
"experience_level",
"abstract",
"private_abstract",
2022-12-07 14:08:54 +00:00
"content_warning",
"technical_requirements",
"project",
"project_url",
"video_url",
2021-08-09 11:12:43 +00:00
"require_approval",
"recording_release",
"materials_release",
]
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)