Merge pull request #371 from bornhack/add_speaker_laptop_boolean_field_to_lightning_talks

Adding "use_provided_speaker_laptop" to EventProposal.
This commit is contained in:
Víðir Valberg Guðmundsson 2019-07-31 20:30:04 +02:00 committed by GitHub
commit 37d40469c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 57 additions and 17 deletions

View file

@ -18,18 +18,19 @@ class CampFactory(DjangoModelFactory):
buildup = factory.LazyFunction( buildup = factory.LazyFunction(
lambda: DateTimeTZRange( lambda: DateTimeTZRange(
lower=timezone.now() - timezone.timedelta(3), upper=timezone.now() lower=timezone.now() - timezone.timedelta(days=3),
upper=timezone.now() - timezone.timedelta(hours=1)
) )
) )
camp = factory.LazyFunction( camp = factory.LazyFunction(
lambda: DateTimeTZRange(lower=timezone.now(), upper=timezone.now()) lambda: DateTimeTZRange(lower=timezone.now(), upper=timezone.now() + timezone.timedelta(days=8))
) )
teardown = factory.LazyFunction( teardown = factory.LazyFunction(
lambda: DateTimeTZRange( lambda: DateTimeTZRange(
lower=timezone.now() + timezone.timedelta(8), lower=timezone.now() + timezone.timedelta(days=8, hours=1),
upper=timezone.now() + timezone.timedelta(11), upper=timezone.now() + timezone.timedelta(days=11),
) )
) )

View file

@ -218,6 +218,7 @@ class EventProposalForm(forms.ModelForm):
"slides_url", "slides_url",
"submission_notes", "submission_notes",
"track", "track",
"use_provided_speaker_laptop",
] ]
def clean_duration(self): def clean_duration(self):
@ -262,6 +263,15 @@ class EventProposalForm(forms.ModelForm):
# initialise form # initialise form
super().__init__(*args, **kwargs) 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 # disable the empty_label for the track select box
self.fields["track"].empty_label = None self.fields["track"].empty_label = None
self.fields["track"].queryset = EventTrack.objects.filter(camp=camp) 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 # make sure video_recording checkbox defaults to checked
self.fields["allow_video_recording"].initial = True 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 # Only talk or lightning talk should show the slides_url field
del self.fields["slides_url"] 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 # fix label and help_text for the title field
self.fields["title"].label = "Title of debate" self.fields["title"].label = "Title of debate"
self.fields["title"].help_text = "The title of this debate" self.fields["title"].help_text = "The title of this debate"
@ -293,7 +307,7 @@ class EventProposalForm(forms.ModelForm):
"placeholder" "placeholder"
] = "Debate Duration (minutes)" ] = "Debate Duration (minutes)"
elif eventtype.name == "Music Act": elif eventtype.name == MUSIC_ACT:
# fix label and help_text for the title field # fix label and help_text for the title field
self.fields["title"].label = "Title of music act" self.fields["title"].label = "Title of music act"
self.fields["title"].help_text = "The title of this music act/concert/set." 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 # better placeholder text for duration field
self.fields["duration"].widget.attrs["placeholder"] = "Duration (minutes)" 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 # fix label and help_text for the title field
self.fields["title"].label = "Event Title" self.fields["title"].label = "Event Title"
self.fields["title"].help_text = "The title of this recreational event" 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"].label = "Event Duration"
self.fields["duration"].widget.attrs["placeholder"] = "Duration (minutes)" 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 # fix label and help_text for the title field
self.fields["title"].label = "Title of Talk" self.fields["title"].label = "Title of Talk"
self.fields["title"].help_text = "The title of this talk/presentation." self.fields["title"].help_text = "The title of this talk/presentation."
@ -355,7 +369,7 @@ class EventProposalForm(forms.ModelForm):
"submission_notes" "submission_notes"
].help_text = "Private notes regarding this talk. Only visible to yourself and the BornHack organisers." ].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[ self.fields[
"slides_url" "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." ].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 # no duration for talks
del self.fields["duration"] del self.fields["duration"]
elif eventtype.name == "Workshop": elif eventtype.name == WORKSHOP:
# fix label and help_text for the title field # fix label and help_text for the title field
self.fields["title"].label = "Workshop Title" self.fields["title"].label = "Workshop Title"
self.fields["title"].help_text = "The title of this workshop." self.fields["title"].help_text = "The title of this workshop."
@ -389,7 +403,7 @@ class EventProposalForm(forms.ModelForm):
"duration" "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)." ].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 # fix label and help_text for the title field
self.fields["title"].label = "Event Title" self.fields["title"].label = "Event Title"
self.fields["title"].help_text = "The title of this recreational event." self.fields["title"].help_text = "The title of this recreational event."
@ -415,7 +429,7 @@ class EventProposalForm(forms.ModelForm):
"duration" "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)." ].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 # fix label and help_text for the title field
self.fields["title"].label = "Meetup Title" self.fields["title"].label = "Meetup Title"
self.fields["title"].help_text = "The title of this meetup." self.fields["title"].help_text = "The title of this meetup."

View file

@ -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?'),
),
]

View file

@ -340,6 +340,10 @@ class EventProposal(UserSubmittedModel):
blank=True, blank=True,
) )
use_provided_speaker_laptop = models.BooleanField(
help_text="Will you be using the provided speaker laptop?", default=False
)
@property @property
def camp(self): def camp(self):
return self.track.camp return self.track.camp

View file

@ -9,7 +9,7 @@ Call for Participation | {{ block.super }}
{% if not camp.call_for_participation_open %} {% if not camp.call_for_participation_open %}
<div class="alert alert-danger"> <div class="alert alert-danger">
<strong>Note!</strong> This Call for Particilation is not open. <strong>Note!</strong> This Call for Participation is not open.
</div> </div>
{% endif %} {% endif %}

View file

@ -4,7 +4,7 @@
{% if not camp.call_for_participation_open %} {% if not camp.call_for_participation_open %}
<div class="alert alert-danger"> <div class="alert alert-danger">
<strong>Note!</strong> This Call for Particilation is not open. <strong>Note!</strong> This Call for Participation is not open.
</div> </div>
{% endif %} {% endif %}

View file

@ -6,6 +6,9 @@
<strong>ID</strong>: {{ eventproposal.uuid }}<br /> <strong>ID</strong>: {{ eventproposal.uuid }}<br />
<strong>Status</strong>: {{ eventproposal.proposal_status }}<br /> <strong>Status</strong>: {{ eventproposal.proposal_status }}<br />
<strong>Duration</strong>: {{ eventproposal.duration|default:"Not defined" }}<br /> <strong>Duration</strong>: {{ eventproposal.duration|default:"Not defined" }}<br />
{% if eventproposal.event_type.name == "Lightning Talk" %}
<strong>Use provided laptop?</strong>: {{ eventproposal.use_provided_speaker_laptop }}<br />
{% endif %}
</div> </div>
</div> </div>

View file

@ -10,7 +10,7 @@ Proposals | {{ block.super }}
{% include 'includes/event_proposal_type_select.html' %} {% include 'includes/event_proposal_type_select.html' %}
{% else %} {% else %}
<div class="alert alert-danger"> <div class="alert alert-danger">
<strong>Note!</strong> This Call for Particilation is not open. <strong>Note!</strong> This Call for Participation is not open.
</div> </div>
{% endif %} {% endif %}

View file

@ -4,7 +4,7 @@
{% if not camp.call_for_participation_open %} {% if not camp.call_for_participation_open %}
<div class="alert alert-danger"> <div class="alert alert-danger">
<strong>Note!</strong> This Call for Particilation is not open. <strong>Note!</strong> This Call for Participation is not open.
</div> </div>
{% endif %} {% endif %}