From 7236462023fdbcce5ab41b0b0a14d9f4d2ed6350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Wed, 31 Jul 2019 12:47:38 +0200 Subject: [PATCH] Adding "use_provided_speaker_laptop" to EventProposal. --- src/program/forms.py | 32 +++++++++++++------ ...entproposal_use_provided_speaker_laptop.py | 18 +++++++++++ src/program/models.py | 4 +++ 3 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 src/program/migrations/0073_eventproposal_use_provided_speaker_laptop.py diff --git a/src/program/forms.py b/src/program/forms.py index fed70538..614c2669 100644 --- a/src/program/forms.py +++ b/src/program/forms.py @@ -218,6 +218,7 @@ class EventProposalForm(forms.ModelForm): "slides_url", "submission_notes", "track", + "use_provided_speaker_laptop", ] def clean_duration(self): @@ -262,6 +263,15 @@ class EventProposalForm(forms.ModelForm): # initialise form super().__init__(*args, **kwargs) + TALK = "Talk" + LIGHTNING_TALK = "Lightning Talk" + DEBATE = "Debate" + MUSIC_ACT = "Music Act" + RECREATIONAL_EVENT = "Recreational Event" + WORKSHOP = "Workshop" + SLACKING_OFF = "Slacking Off" + MEETUP = "Meetup" + # disable the empty_label for the track select box self.fields["track"].empty_label = None self.fields["track"].queryset = EventTrack.objects.filter(camp=camp) @@ -269,11 +279,15 @@ class EventProposalForm(forms.ModelForm): # make sure video_recording checkbox defaults to checked self.fields["allow_video_recording"].initial = True - if not (eventtype.name == "Talk" or eventtype.name == "Lightning Talk"): + if eventtype.name not in [TALK, LIGHTNING_TALK]: # Only talk or lightning talk should show the slides_url field del self.fields["slides_url"] - if eventtype.name == "Debate": + if not eventtype.name == LIGHTNING_TALK: + # Only lightning talks submissions will have to choose whether to use provided speaker laptop + del self.fields["use_provided_speaker_laptop"] + + if eventtype.name == DEBATE: # fix label and help_text for the title field self.fields["title"].label = "Title of debate" self.fields["title"].help_text = "The title of this debate" @@ -293,7 +307,7 @@ class EventProposalForm(forms.ModelForm): "placeholder" ] = "Debate Duration (minutes)" - elif eventtype.name == "Music Act": + elif eventtype.name == MUSIC_ACT: # fix label and help_text for the title field self.fields["title"].label = "Title of music act" self.fields["title"].help_text = "The title of this music act/concert/set." @@ -314,7 +328,7 @@ class EventProposalForm(forms.ModelForm): # better placeholder text for duration field self.fields["duration"].widget.attrs["placeholder"] = "Duration (minutes)" - elif eventtype.name == "Recreational Event": + elif eventtype.name == RECREATIONAL_EVENT: # fix label and help_text for the title field self.fields["title"].label = "Event Title" self.fields["title"].help_text = "The title of this recreational event" @@ -338,7 +352,7 @@ class EventProposalForm(forms.ModelForm): self.fields["duration"].label = "Event Duration" self.fields["duration"].widget.attrs["placeholder"] = "Duration (minutes)" - elif eventtype.name == "Talk" or eventtype.name == "Lightning Talk": + elif eventtype.name in [TALK, LIGHTNING_TALK]: # fix label and help_text for the title field self.fields["title"].label = "Title of Talk" self.fields["title"].help_text = "The title of this talk/presentation." @@ -355,7 +369,7 @@ class EventProposalForm(forms.ModelForm): "submission_notes" ].help_text = "Private notes regarding this talk. Only visible to yourself and the BornHack organisers." - if self.fields.get("slides_url") and eventtype.name == "Lightning Talk": + if self.fields.get("slides_url") and eventtype.name == LIGHTNING_TALK: self.fields[ "slides_url" ].help_text += " You will only get assigned a slot if you have provided slides (a title slide is enough if you don't use slides for the talk). You can add an URL later if need be." @@ -363,7 +377,7 @@ class EventProposalForm(forms.ModelForm): # no duration for talks del self.fields["duration"] - elif eventtype.name == "Workshop": + elif eventtype.name == WORKSHOP: # fix label and help_text for the title field self.fields["title"].label = "Workshop Title" self.fields["title"].help_text = "The title of this workshop." @@ -389,7 +403,7 @@ class EventProposalForm(forms.ModelForm): "duration" ].help_text = "How much time (in minutes) should we set aside for this workshop? Please keep it between 60 and 180 minutes (1-3 hours)." - elif eventtype.name == "Slacking Off": + elif eventtype.name == SLACKING_OFF: # fix label and help_text for the title field self.fields["title"].label = "Event Title" self.fields["title"].help_text = "The title of this recreational event." @@ -415,7 +429,7 @@ class EventProposalForm(forms.ModelForm): "duration" ].help_text = "How much time (in minutes) should we set aside for this event? Please keep it between 60 and 180 minutes (1-3 hours)." - elif eventtype.name == "Meetup": + elif eventtype.name == MEETUP: # fix label and help_text for the title field self.fields["title"].label = "Meetup Title" self.fields["title"].help_text = "The title of this meetup." diff --git a/src/program/migrations/0073_eventproposal_use_provided_speaker_laptop.py b/src/program/migrations/0073_eventproposal_use_provided_speaker_laptop.py new file mode 100644 index 00000000..ebe5ff4c --- /dev/null +++ b/src/program/migrations/0073_eventproposal_use_provided_speaker_laptop.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.3 on 2019-07-31 10:46 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('program', '0072_auto_20190616_1746'), + ] + + operations = [ + migrations.AddField( + model_name='eventproposal', + name='use_provided_speaker_laptop', + field=models.BooleanField(default=False, help_text='Will you be using the provided speaker laptop?'), + ), + ] diff --git a/src/program/models.py b/src/program/models.py index eace0260..6b30b182 100644 --- a/src/program/models.py +++ b/src/program/models.py @@ -340,6 +340,10 @@ class EventProposal(UserSubmittedModel): blank=True, ) + use_provided_speaker_laptop = models.BooleanField( + help_text="Will you be using the provided speaker laptop?", default=False + ) + @property def camp(self): return self.track.camp