2017-09-22 02:48:09 +00:00
|
|
|
import copy
|
|
|
|
|
2015-10-16 17:53:02 +00:00
|
|
|
from django import forms
|
|
|
|
|
2017-04-24 13:35:04 +00:00
|
|
|
from pinaxcon.proposals.models import TalkProposal, TutorialProposal, MiniconfProposal
|
2017-09-22 02:48:09 +00:00
|
|
|
from pinaxcon.proposals.models import SysAdminProposal, KernelProposal, OpenHardwareProposal
|
|
|
|
from pinaxcon.proposals.models import GamesProposal, ClsXLCAProposal, FuncProgProposal
|
|
|
|
from pinaxcon.proposals.models import OpenEdProposal, OpenGLAMProposal, FPGAProposal, DevDevProposal
|
|
|
|
from pinaxcon.proposals.models import ArtTechProposal, BioInformaticsProposal
|
|
|
|
|
|
|
|
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.append("talk_format")
|
2017-03-05 07:34:15 +00:00
|
|
|
|
2015-10-16 17:53:02 +00:00
|
|
|
class ProposalForm(forms.ModelForm):
|
|
|
|
|
2017-04-24 13:10:51 +00:00
|
|
|
required_css_class = 'label-required'
|
|
|
|
|
2015-10-16 17:53:02 +00:00
|
|
|
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",
|
2016-06-20 23:58:27 +00:00
|
|
|
"target_audience",
|
2015-10-16 17:53:02 +00:00
|
|
|
"abstract",
|
2016-06-20 23:58:27 +00:00
|
|
|
"private_abstract",
|
|
|
|
"technical_requirements",
|
|
|
|
"project",
|
|
|
|
"project_url",
|
|
|
|
"video_url",
|
2015-10-16 17:53:02 +00:00
|
|
|
"recording_release",
|
2016-06-20 23:58:27 +00:00
|
|
|
"materials_release",
|
2015-10-16 17:53:02 +00:00
|
|
|
]
|
2016-06-21 11:47:45 +00:00
|
|
|
|
2016-06-29 13:17:15 +00:00
|
|
|
|
2016-06-21 11:47:45 +00:00
|
|
|
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",
|
|
|
|
]
|
|
|
|
|
2016-06-29 13:17:15 +00:00
|
|
|
|
2016-06-21 11:47:45 +00:00
|
|
|
class MiniconfProposalForm(ProposalForm):
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = MiniconfProposal
|
|
|
|
fields = [
|
|
|
|
"title",
|
|
|
|
"abstract",
|
|
|
|
"private_abstract",
|
|
|
|
"technical_requirements",
|
2017-07-02 12:28:29 +00:00
|
|
|
"recording_release",
|
|
|
|
"materials_release",
|
2016-06-21 11:47:45 +00:00
|
|
|
]
|
2017-09-20 12:50:39 +00:00
|
|
|
|
2017-09-22 02:48:09 +00:00
|
|
|
class SysadminProposalForm(ProposalForm):
|
2017-09-20 12:50:39 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = SysAdminProposal
|
2017-09-22 02:48:09 +00:00
|
|
|
fields = TALK_FORMAT_FIELDS
|
2017-09-20 12:50:39 +00:00
|
|
|
|
|
|
|
class KernelProposalForm(ProposalForm):
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = KernelProposal
|
2017-09-22 02:48:09 +00:00
|
|
|
fields = DEFAULT_FIELDS
|
2017-09-20 12:50:39 +00:00
|
|
|
|
|
|
|
class GamesProposalForm(ProposalForm):
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = GamesProposal
|
2017-09-22 02:48:09 +00:00
|
|
|
fields = TALK_FORMAT_FIELDS
|
2017-09-20 12:50:39 +00:00
|
|
|
|
|
|
|
class OpenHardwareProposalForm(ProposalForm):
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = OpenHardwareProposal
|
2017-09-22 02:48:09 +00:00
|
|
|
fields = TALK_FORMAT_FIELDS
|
|
|
|
|
|
|
|
class OpenEdProposalForm(ProposalForm):
|
|
|
|
|
|
|
|
class Meta:
|
2018-09-29 05:56:44 +00:00
|
|
|
model = OpenEdProposal
|
2017-09-22 02:48:09 +00:00
|
|
|
fields = DEFAULT_FIELDS
|
|
|
|
|
|
|
|
class DevDevProposalForm(ProposalForm):
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = DevDevProposal
|
|
|
|
fields = DEFAULT_FIELDS
|
|
|
|
|
|
|
|
class ArtTechProposalForm(ProposalForm):
|
|
|
|
|
|
|
|
class Meta:
|
2017-10-15 08:04:26 +00:00
|
|
|
ARTTECH_FIELDS = copy.copy(DEFAULT_FIELDS)
|
|
|
|
ARTTECH_FIELDS.remove("target_audience")
|
|
|
|
ARTTECH_FIELDS.append("talk_format")
|
|
|
|
ARTTECH_FIELDS.append("can_exhibit")
|
|
|
|
ARTTECH_FIELDS.append("exhibition_requirements")
|
|
|
|
|
2017-09-22 02:48:09 +00:00
|
|
|
model = ArtTechProposal
|
2017-10-15 08:04:26 +00:00
|
|
|
fields = ARTTECH_FIELDS
|