diff --git a/pinaxcon/proposals/models.py b/pinaxcon/proposals/models.py index 2495e15b0b0b1d470cfe4f6fe559079494e5bd78..523782be122e314ab64fa36511058b7212b73d75 100644 --- a/pinaxcon/proposals/models.py +++ b/pinaxcon/proposals/models.py @@ -1,6 +1,8 @@ from django.db import models +from django.utils.translation import ugettext_lazy as _ from symposion.proposals.models import ProposalBase +from symposion.text_parser import parse class Proposal(ProposalBase): @@ -17,6 +19,48 @@ class Proposal(ProposalBase): (TARGET_BUSINESS, "Business"), ] + TOPIC_LINUX = 1 + TOPIC_SOFTWARE = 2 + TOPIC_HARDWARE = 3 + TOPIC_FIRMWARE = 4 + TOPIC_SYSADMIN = 5 + TOPIC_SECURITY = 6 + TOPIC_DOCUMENTATION = 7 + TOPIC_COMMUNITY = 8 + TOPIC_SCIENCE = 9 + TOPIC_GLAM = 10 + TOPIC_MULTIMEDIA = 11 + TOPIC_AEROSPACE = 12 + TOPIC_AGRICULTURE = 13 + TOPIC_OTHER = 14 + + PROPOSAL_TOPIC = [ + (TOPIC_LINUX, "Linux"), + (TOPIC_SOFTWARE, "Software"), + (TOPIC_HARDWARE, "Hardware"), + (TOPIC_FIRMWARE, "Firmware"), + (TOPIC_SYSADMIN, "System Administration / Operations"), + (TOPIC_SECURITY, "Security"), + (TOPIC_DOCUMENTATION, "Documentation"), + (TOPIC_COMMUNITY, "Community"), + (TOPIC_SCIENCE, "Science & Data"), + (TOPIC_GLAM, "Galleries, Libraries, Archives & Museums (GLAM)"), + (TOPIC_MULTIMEDIA, "Multimedia"), + (TOPIC_AEROSPACE, "Aerospace / UAV"), + (TOPIC_AGRICULTURE, "Agriculture"), + (TOPIC_OTHER, "Other"), + ] + + LEVEL_BEGINNER = 1 + LEVEL_INTERMEDIATE = 2 + LEVEL_ADVANCED = 3 + + EXPERIENCE_LEVEL = [ + (LEVEL_BEGINNER, "Beginner"), + (LEVEL_INTERMEDIATE, "Intermediate"), + (LEVEL_ADVANCED, "Advanced"), + ] + target_audience = models.IntegerField( choices=TARGET_AUDIENCES, help_text="Who is the target audience for your session?", @@ -41,50 +85,6 @@ class Proposal(ProposalBase): "Creative Commons Attribution-Share Alike Australia 3.0 Licence" ) - class Meta: - abstract = True - - -class SessionProposal(Proposal): - """ - Base Session Proposal - - This is not a meta class as we want a single table to store the common - data across all session proposal types. - """ - - TOPIC_SOFTWARE = 1 - TOPIC_HARDWARE = 2 - TOPIC_FIRMWARE = 3 - TOPIC_KERNEL = 4 - TOPIC_DOCUMENTATION = 5 - TOPIC_COMMUNITY = 6 - TOPIC_SECURITY = 7 - TOPIC_OPERATIONS = 8 - TOPIC_OTHER = 9 - - PROPOSAL_TOPIC = [ - (TOPIC_SOFTWARE, "Software"), - (TOPIC_HARDWARE, "Hardware"), - (TOPIC_FIRMWARE, "Firmware"), - (TOPIC_KERNEL, "Linux Kernel"), - (TOPIC_DOCUMENTATION, "Documentation"), - (TOPIC_COMMUNITY, "Community"), - (TOPIC_SECURITY, "Security"), - (TOPIC_OPERATIONS, "Deployment & Operations"), - (TOPIC_OTHER, "Other"), - ] - - LEVEL_BEGINNER = 1 - LEVEL_INTERMEDIATE = 2 - LEVEL_ADVANCED = 3 - - EXPERIENCE_LEVEL = [ - (LEVEL_BEGINNER, "Beginner"), - (LEVEL_INTERMEDIATE, "Intermediate"), - (LEVEL_ADVANCED, "Advanced"), - ] - primary_topic = models.IntegerField( choices=PROPOSAL_TOPIC, help_text="What is the primary topic area for your session?" @@ -101,79 +101,29 @@ class SessionProposal(Proposal): "institution before you can confirm your availability to present?" ) - -class TalkProposal(SessionProposal): - - class Meta: - verbose_name = "talk proposal" - - -class TutorialProposal(SessionProposal): - - class Meta: - verbose_name = "tutorial proposal" - - -class MiniconfProposal(Proposal): - """ - Miniconf Proposal - - Note that this is just a Proposal, not a SessionProposal, as it does not - require a number of fields that the others use. - """ - - target_audience = models.IntegerField(choices=Proposal.TARGET_AUDIENCES, - default=Proposal.TARGET_DEVELOPER) - - class Meta: - verbose_name = "miniconf proposal" - - -class MiniconfSessionProposal(SessionProposal): - """ - Base Miniconf Session Proposal - """ + content_warning = models.TextField( + "Content Warning", + help_text=_("This will be shown on the schedule to give attendees " + "advanced warning of topics covered in the session. "), + blank=True, + ) + content_warning_html = models.TextField(blank=True) class Meta: abstract = True + def save(self, *args, **kwargs): + self.content_warning_html = parse(self.content_warning) + return super(Proposal, self).save(*args, **kwargs) -class GlamCommunityProposal(MiniconfSessionProposal): - - class Meta: - verbose_name = "GO GLAM Miniconf Proposal" - - -class KernelProposal(MiniconfSessionProposal): - class Meta: - verbose_name = "Kernel Miniconf Proposal" - - -class OpenHardwareProposal(MiniconfSessionProposal): - - FORMAT_PRESENTATION = 1 - FORMAT_TUTORIAL = 2 - FORMAT_HANDS_ON = 3 - - TALK_FORMATS = [ - (FORMAT_PRESENTATION, "Presentation"), - (FORMAT_TUTORIAL, "Tutorial"), - (FORMAT_HANDS_ON, "Hands-on"), - ] - - talk_format = models.IntegerField( - choices=TALK_FORMATS, - default=FORMAT_PRESENTATION, - help_text="Will your session be a presentation, tutorial or hands-on " - "(e.g how to use KiCAD or some other tooling)?" - ) +class TalkProposal(Proposal): class Meta: - verbose_name = "Open Hardware Miniconf Proposal" + verbose_name = "talk proposal" -class SysAdminProposal(MiniconfSessionProposal): +class TutorialProposal(Proposal): class Meta: - verbose_name = "System Administration Miniconf Proposal" + verbose_name = "tutorial proposal"