From 039af44a92e4c404b8ff1f1de23cd929583760ae Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Sun, 20 May 2018 18:16:20 +0200 Subject: [PATCH 01/18] new content submission flow monster commit of doom. fixes a large part of #191. Split out /program/ urls into a seperate program/urls.py file in the program: URL namespace. Change call for speakers to call for participation everywhere (I think). Add boolean fields call_for_participation_open and call_for_sponsors_open to Camp model. Switch to font-awesome 5.0.13 and update tags everywhere accordingly. Introduce Tracks so all Events belong to a Track, which in turn belongs to a Camp. Add seperate forms for submitting SpeakerProposals and EventProposals so we can set labels and help_text according to EventType, and remove fields we dont need. Remove Pictures from Speaker and SpeakerProposals, it was almost never used, and was a lot of code/complexity. Remove a few PROPOSAL_STATUS namely DRAFT and MODIFIED_AFTER_APPROVAL to simplify the workflow for submitters. Add description, icon and host_title fields to EventType. Add a CombinedProposalSubmitView which allows users to submit a SpeakerProposal and EventProposal from the same page, introducing a new requirements.txt dependency for django-betterforms==1.1.4. Update bootstrap-devsite to match the new reality. --- src/bornhack/settings.py | 1 + src/bornhack/urls.py | 122 +- src/camps/management/commands/createcamp.py | 3 +- .../migrations/0026_auto_20180506_1633.py | 23 + src/camps/models.py | 27 +- .../templates/bornhack-2017_camp_detail.html | 2 +- .../templates/bornhack-2018_camp_detail.html | 2 +- .../templates/bornhack-2019_camp_detail.html | 2 +- src/events/handler.py | 2 +- src/ircbot/models.py | 2 +- src/profiles/templates/profile_detail.html | 2 +- src/profiles/templates/profile_form.html | 4 +- src/program/admin.py | 11 +- src/program/forms.py | 267 ++ .../migrations/0048_auto_20180512_1625.py | 134 + .../migrations/0049_add_event_tracks.py | 30 + .../migrations/0050_auto_20180512_1650.py | 25 + .../migrations/0051_auto_20180512_1801.py | 24 + .../migrations/0052_auto_20180519_2324.py | 18 + .../migrations/0053_auto_20180519_2325.py | 18 + .../migrations/0054_auto_20180520_1509.py | 22 + src/program/mixins.py | 67 +- src/program/models.py | 289 +- .../bornhack-2016_call_for_participation.html | 56 + .../bornhack-2017_call_for_participation.html | 58 + .../bornhack-2018_call_for_participation.html | 11 + .../bornhack-2019_call_for_participation.html | 1 + .../templates/combined_proposal_submit.html | 16 + src/program/templates/event_list.html | 6 +- .../templates/event_proposal_add_person.html | 15 + .../event_proposal_select_person.html | 33 + .../templates/event_proposal_type_select.html | 10 + src/program/templates/event_type_select.html | 10 + .../templates/eventproposal_detail.html | 2 +- src/program/templates/eventproposal_form.html | 9 +- .../templates/eventproposal_submit.html | 14 - .../includes/event_proposal_type_select.html | 30 + .../templates/includes/program_menu.html | 10 + .../templates/noscript_schedule_view.html | 2 +- src/program/templates/program_base.html | 14 +- src/program/templates/proposal_delete.html | 19 + src/program/templates/proposal_list.html | 196 +- src/program/templates/schedule_base.html | 14 +- src/program/templates/schedule_day.html | 2 +- .../templates/schedule_event_detail.html | 4 +- src/program/templates/schedule_overview.html | 6 +- src/program/templates/speaker_detail.html | 13 +- src/program/templates/speaker_list.html | 4 +- .../templates/speakerproposal_delete.html | 15 + .../templates/speakerproposal_detail.html | 6 +- .../templates/speakerproposal_form.html | 12 +- src/program/urls.py | 141 + src/program/utils.py | 38 + src/program/views.py | 490 ++- src/requirements/production.txt | 1 + src/static_src/css/font-awesome.min.css | 4 - src/static_src/css/fontawesome-all.min.css | 5 + src/static_src/fonts/FontAwesome.otf | Bin 134808 -> 0 bytes src/static_src/fonts/fontawesome-webfont.eot | Bin 165742 -> 0 bytes src/static_src/fonts/fontawesome-webfont.svg | 2671 ----------------- src/static_src/fonts/fontawesome-webfont.ttf | Bin 165548 -> 0 bytes src/static_src/fonts/fontawesome-webfont.woff | Bin 98024 -> 0 bytes .../fonts/fontawesome-webfont.woff2 | Bin 77160 -> 0 bytes src/static_src/webfonts/fa-solid-900.eot | Bin 0 -> 133140 bytes src/static_src/webfonts/fa-solid-900.svg | 1896 ++++++++++++ src/static_src/webfonts/fa-solid-900.ttf | Bin 0 -> 132920 bytes src/static_src/webfonts/fa-solid-900.woff | Bin 0 -> 63836 bytes src/static_src/webfonts/fa-solid-900.woff2 | Bin 0 -> 50372 bytes src/teams/templates/fix_irc_acl.html | 4 +- src/teams/templates/team_detail.html | 14 +- src/teams/templates/team_join.html | 4 +- src/teams/templates/team_leave.html | 4 +- src/teams/templates/team_list.html | 8 +- src/teams/templates/team_manage.html | 8 +- src/teams/templates/teammember_approve.html | 4 +- src/teams/templates/teammember_remove.html | 4 +- src/templates/base.html | 12 +- src/tickets/templates/ticket_list.html | 6 +- .../management/commands/bootstrap-devsite.py | 130 +- 79 files changed, 3737 insertions(+), 3392 deletions(-) create mode 100644 src/camps/migrations/0026_auto_20180506_1633.py create mode 100644 src/program/forms.py create mode 100644 src/program/migrations/0048_auto_20180512_1625.py create mode 100644 src/program/migrations/0049_add_event_tracks.py create mode 100644 src/program/migrations/0050_auto_20180512_1650.py create mode 100644 src/program/migrations/0051_auto_20180512_1801.py create mode 100644 src/program/migrations/0052_auto_20180519_2324.py create mode 100644 src/program/migrations/0053_auto_20180519_2325.py create mode 100644 src/program/migrations/0054_auto_20180520_1509.py create mode 100644 src/program/templates/bornhack-2016_call_for_participation.html create mode 100644 src/program/templates/bornhack-2017_call_for_participation.html create mode 100644 src/program/templates/bornhack-2018_call_for_participation.html create mode 100644 src/program/templates/bornhack-2019_call_for_participation.html create mode 100644 src/program/templates/combined_proposal_submit.html create mode 100644 src/program/templates/event_proposal_add_person.html create mode 100644 src/program/templates/event_proposal_select_person.html create mode 100644 src/program/templates/event_proposal_type_select.html create mode 100644 src/program/templates/event_type_select.html delete mode 100644 src/program/templates/eventproposal_submit.html create mode 100644 src/program/templates/includes/event_proposal_type_select.html create mode 100644 src/program/templates/includes/program_menu.html create mode 100644 src/program/templates/proposal_delete.html create mode 100644 src/program/templates/speakerproposal_delete.html create mode 100644 src/program/urls.py create mode 100644 src/program/utils.py delete mode 100644 src/static_src/css/font-awesome.min.css create mode 100644 src/static_src/css/fontawesome-all.min.css delete mode 100644 src/static_src/fonts/FontAwesome.otf delete mode 100644 src/static_src/fonts/fontawesome-webfont.eot delete mode 100644 src/static_src/fonts/fontawesome-webfont.svg delete mode 100644 src/static_src/fonts/fontawesome-webfont.ttf delete mode 100644 src/static_src/fonts/fontawesome-webfont.woff delete mode 100644 src/static_src/fonts/fontawesome-webfont.woff2 create mode 100644 src/static_src/webfonts/fa-solid-900.eot create mode 100644 src/static_src/webfonts/fa-solid-900.svg create mode 100644 src/static_src/webfonts/fa-solid-900.ttf create mode 100644 src/static_src/webfonts/fa-solid-900.woff create mode 100644 src/static_src/webfonts/fa-solid-900.woff2 diff --git a/src/bornhack/settings.py b/src/bornhack/settings.py index 9283d8fe..6907fec8 100644 --- a/src/bornhack/settings.py +++ b/src/bornhack/settings.py @@ -51,6 +51,7 @@ INSTALLED_APPS = [ 'allauth.account', 'bootstrap3', 'django_extensions', + 'betterforms', ] #MEDIA_URL = '/media/' diff --git a/src/bornhack/urls.py b/src/bornhack/urls.py index e50c504a..7a2d1957 100644 --- a/src/bornhack/urls.py +++ b/src/bornhack/urls.py @@ -135,126 +135,8 @@ urlpatterns = [ ), url( - r'^program/', include([ - url( - r'^$', - ScheduleView.as_view(), - name='schedule_index' - ), - url( - r'^noscript/$', - NoScriptScheduleView.as_view(), - name='noscript_schedule_index' - ), - url( - r'^ics/', ICSView.as_view(), name="ics_view" - ), - url( - r'^control/', ProgramControlCenter.as_view(), name="program_control_center" - ), - url( - r'^proposals/', include([ - url( - r'^$', - ProposalListView.as_view(), - name='proposal_list', - ), - url( - r'^speakers/', include([ - url( - r'^create/$', - SpeakerProposalCreateView.as_view(), - name='speakerproposal_create' - ), - url( - r'^(?P[a-f0-9-]+)/$', - SpeakerProposalDetailView.as_view(), - name='speakerproposal_detail' - ), - url( - r'^(?P[a-f0-9-]+)/edit/$', - SpeakerProposalUpdateView.as_view(), - name='speakerproposal_update' - ), - url( - r'^(?P[a-f0-9-]+)/submit/$', - SpeakerProposalSubmitView.as_view(), - name='speakerproposal_submit' - ), - url( - r'^(?P[a-f0-9-]+)/pictures/(?P[-_\w+]+)/$', - SpeakerProposalPictureView.as_view(), - name='speakerproposal_picture', - ), - ]) - ), - url( - r'^events/', include([ - url( - r'^create/$', - EventProposalCreateView.as_view(), - name='eventproposal_create' - ), - url( - r'^(?P[a-f0-9-]+)/$', - EventProposalDetailView.as_view(), - name='eventproposal_detail' - ), - url( - r'^(?P[a-f0-9-]+)/edit/$', - EventProposalUpdateView.as_view(), - name='eventproposal_update' - ), - url( - r'^(?P[a-f0-9-]+)/submit/$', - EventProposalSubmitView.as_view(), - name='eventproposal_submit' - ), - ]) - ), - ]) - ), - url( - r'^speakers/', include([ - url( - r'^$', - SpeakerListView.as_view(), - name='speaker_index' - ), - url( - r'^(?P[-_\w+]+)/$', - SpeakerDetailView.as_view(), - name='speaker_detail' - ), - url( - r'^(?P[-_\w+]+)/pictures/(?P[-_\w+]+)/$', - SpeakerPictureView.as_view(), - name='speaker_picture', - ), - ]), - ), - url( - r'^events/$', - EventListView.as_view(), - name='event_index' - ), - url( - r'^call-for-speakers/$', - CallForSpeakersView.as_view(), - name='call_for_speakers' - ), - url( - r'^calendar/', - ICSView.as_view(), - name='ics_calendar' - ), - # this has to be the last URL here - url( - r'^(?P[-_\w+]+)/$', - EventDetailView.as_view(), - name='event_detail' - ), - ]) + r'^program/', + include('program.urls', namespace='program'), ), url( diff --git a/src/camps/management/commands/createcamp.py b/src/camps/management/commands/createcamp.py index 4c55bfcc..77ea7af1 100644 --- a/src/camps/management/commands/createcamp.py +++ b/src/camps/management/commands/createcamp.py @@ -30,7 +30,7 @@ class Command(BaseCommand): files = [ 'sponsors/templates/{camp_slug}_sponsors.html', 'camps/templates/{camp_slug}_camp_detail.html', - 'program/templates/{camp_slug}_call_for_speakers.html' + 'program/templates/{camp_slug}_call_for_participation.html' ] # directories to create, relative to DJANGO_BASE_PATH @@ -68,3 +68,4 @@ class Command(BaseCommand): 'static_src/img/{camp_slug}/logo/{camp_slug}-logo-small.png'.format(camp_slug=camp_slug) ) ) + diff --git a/src/camps/migrations/0026_auto_20180506_1633.py b/src/camps/migrations/0026_auto_20180506_1633.py new file mode 100644 index 00000000..f99bcb1e --- /dev/null +++ b/src/camps/migrations/0026_auto_20180506_1633.py @@ -0,0 +1,23 @@ +# Generated by Django 2.0.4 on 2018-05-06 14:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('camps', '0025_auto_20180318_1250'), + ] + + operations = [ + migrations.AddField( + model_name='camp', + name='call_for_participation_open', + field=models.BooleanField(default=False, help_text='Check if the Call for Participation is open for this camp'), + ), + migrations.AddField( + model_name='camp', + name='call_for_sponsors_open', + field=models.BooleanField(default=False, help_text='Check if the Call for Sponsors is open for this camp'), + ), + ] diff --git a/src/camps/models.py b/src/camps/models.py index d390aa13..5ea46c30 100644 --- a/src/camps/models.py +++ b/src/camps/models.py @@ -65,6 +65,16 @@ class Camp(CreatedUpdatedModel, UUIDModel): max_length=7 ) + call_for_participation_open = models.BooleanField( + help_text='Check if the Call for Participation is open for this camp', + default=False, + ) + + call_for_sponsors_open = models.BooleanField( + help_text='Check if the Call for Sponsors is open for this camp', + default=False, + ) + def get_absolute_url(self): return reverse('camp_detail', kwargs={'camp_slug': self.slug}) @@ -91,7 +101,7 @@ class Camp(CreatedUpdatedModel, UUIDModel): @property def event_types(self): - # return all event types with at least one event in this camp + """ Return all event types with at least one event in this camp """ return EventType.objects.filter(event__instances__isnull=False, event__camp=self).distinct() @property @@ -179,18 +189,3 @@ class Camp(CreatedUpdatedModel, UUIDModel): ''' return self.get_days('teardown') - @property - def call_for_speakers_open(self): - if self.camp.upper < timezone.now(): - return False - else: - return True - - @property - def call_for_sponsors_open(self): - """ Keep call for sponsors open 30 days after camp end """ - if self.camp.upper + timedelta(days=30) < timezone.now(): - return False - else: - return True - diff --git a/src/camps/templates/bornhack-2017_camp_detail.html b/src/camps/templates/bornhack-2017_camp_detail.html index 826622dd..dbf6e255 100644 --- a/src/camps/templates/bornhack-2017_camp_detail.html +++ b/src/camps/templates/bornhack-2017_camp_detail.html @@ -52,7 +52,7 @@ {% thumbnail 'img/bornhack-2016/fonsmark' 'FB1_5149.JPG' 'Danish politicians debating at BornHack 2016' %}
-
We want to encourage hackers, makers, politicians, activists, developers, artists, sysadmins, engineers with something to say to read our call for speakers.
+
We want to encourage hackers, makers, politicians, activists, developers, artists, sysadmins, engineers with something to say to read our call for participation.
diff --git a/src/camps/templates/bornhack-2018_camp_detail.html b/src/camps/templates/bornhack-2018_camp_detail.html index e3efbdb0..93242151 100644 --- a/src/camps/templates/bornhack-2018_camp_detail.html +++ b/src/camps/templates/bornhack-2018_camp_detail.html @@ -52,7 +52,7 @@ {% thumbnail 'img/bornhack-2016/fonsmark' 'FB1_5149.JPG' 'Danish politicians debating at BornHack 2016' %}
-
We want to encourage hackers, makers, politicians, activists, developers, artists, sysadmins, engineers with something to say to read our call for speakers.
+
We want to encourage hackers, makers, politicians, activists, developers, artists, sysadmins, engineers with something to say to read our call for participation.
diff --git a/src/camps/templates/bornhack-2019_camp_detail.html b/src/camps/templates/bornhack-2019_camp_detail.html index 774fcd29..f08598a7 100644 --- a/src/camps/templates/bornhack-2019_camp_detail.html +++ b/src/camps/templates/bornhack-2019_camp_detail.html @@ -52,7 +52,7 @@ {% thumbnail 'img/bornhack-2016/fonsmark' 'FB1_5149.JPG' 'Danish politicians debating at BornHack 2016' %}
-
We want to encourage hackers, makers, politicians, activists, developers, artists, sysadmins, engineers with something to say to read our call for speakers.
+
We want to encourage hackers, makers, politicians, activists, developers, artists, sysadmins, engineers with something to say to read our call for participation.
diff --git a/src/events/handler.py b/src/events/handler.py index 77d21e04..ab1e0cd5 100644 --- a/src/events/handler.py +++ b/src/events/handler.py @@ -11,7 +11,7 @@ def handle_team_event(eventtype, irc_message=None, irc_timeout=60, email_templat The type of event determines which teams receive notifications. TODO: Add some sort of priority to messages """ - logger.info("Inside handle_team_event, eventtype %s" % eventtype) + #logger.info("Inside handle_team_event, eventtype %s" % eventtype) # get event type from database from .models import Type diff --git a/src/ircbot/models.py b/src/ircbot/models.py index 23c5207e..05b56ead 100644 --- a/src/ircbot/models.py +++ b/src/ircbot/models.py @@ -12,7 +12,7 @@ class OutgoingIrcMessage(CreatedUpdatedModel): expired = models.BooleanField(default=False) def __str__(self): - return "PRIVMSG %s %s (%s)" % (self.target, self.message, 'processed' if self.processed else 'unprocessed') + return "PRIVMSG %s %s (%s)" % (self.target, self.message, 'processed' if self.processed else 'unprocessed') def clean(self): if not self.pk: diff --git a/src/profiles/templates/profile_detail.html b/src/profiles/templates/profile_detail.html index 84ba1938..09c44898 100644 --- a/src/profiles/templates/profile_detail.html +++ b/src/profiles/templates/profile_detail.html @@ -22,5 +22,5 @@ {{ profile.nickserv_username|default:"N/A" }} - Edit Profile + Edit Profile {% endblock profile_content %} diff --git a/src/profiles/templates/profile_form.html b/src/profiles/templates/profile_form.html index f8ebd8a0..60fd167d 100644 --- a/src/profiles/templates/profile_form.html +++ b/src/profiles/templates/profile_form.html @@ -6,7 +6,7 @@
{% csrf_token %} {% bootstrap_form form %} - - Cancel + + Cancel
{% endblock profile_content %} diff --git a/src/program/admin.py b/src/program/admin.py index eebfa209..6611ba98 100644 --- a/src/program/admin.py +++ b/src/program/admin.py @@ -11,6 +11,7 @@ from .models import ( EventType, EventInstance, EventLocation, + EventTrack, SpeakerProposal, EventProposal, Favorite @@ -47,7 +48,7 @@ class EventProposalAdmin(admin.ModelAdmin): mark_eventproposal_as_approved.description = 'Approve and create Event object(s)' actions = ['mark_eventproposal_as_approved'] - list_filter = ('camp', 'proposal_status', 'user') + list_filter = ('track', 'proposal_status', 'user') @admin.register(EventLocation) @@ -56,6 +57,11 @@ class EventLocationAdmin(admin.ModelAdmin): list_display = ('name', 'camp') +@admin.register(EventTrack) +class EventTrackAdmin(admin.ModelAdmin): + list_filter = ('camp',) + list_display = ('name', 'camp') + @admin.register(EventInstance) class EventInstanceAdmin(admin.ModelAdmin): pass @@ -82,7 +88,7 @@ class SpeakerInline(admin.StackedInline): @admin.register(Event) class EventAdmin(admin.ModelAdmin): - list_filter = ('camp', 'speakers') + list_filter = ('track', 'speakers') list_display = [ 'title', 'event_type', @@ -91,3 +97,4 @@ class EventAdmin(admin.ModelAdmin): inlines = [ SpeakerInline ] + diff --git a/src/program/forms.py b/src/program/forms.py new file mode 100644 index 00000000..1cf6fe0a --- /dev/null +++ b/src/program/forms.py @@ -0,0 +1,267 @@ +from django import forms +from betterforms.multiform import MultiModelForm +from collections import OrderedDict +from .models import SpeakerProposal, EventProposal, EventTrack +from django.forms.widgets import TextInput +from django.utils.dateparse import parse_duration +import logging +logger = logging.getLogger("bornhack.%s" % __name__) + + +class BaseSpeakerProposalForm(forms.ModelForm): + """ + The BaseSpeakerProposalForm is not used directly. + It is subclassed for each eventtype, where fields are removed or get new labels and help_text as needed + """ + class Meta: + model = SpeakerProposal + fields = ['name', 'biography', 'needs_oneday_ticket', 'submission_notes'] + + +class BaseEventProposalForm(forms.ModelForm): + """ + The BaseEventProposalForm is not used directly. + It is subclassed for each eventtype, where fields are removed or get new labels and help_text as needed + """ + class Meta: + model = EventProposal + fields = ['title', 'abstract', 'allow_video_recording', 'duration', 'submission_notes', 'track'] + + def clean_duration(self): + duration = self.cleaned_data['duration'] + if duration < 60 or duration > 180: + raise forms.ValidationError("Please keep duration between 60 and 180 minutes.") + return duration + + def clean_track(self): + track = self.cleaned_data['track'] + # TODO: make sure the track is part of the current camp, needs camp as form kwarg to verify + return track + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + # disable the empty_label for the track select box + self.fields['track'].empty_label = None + + +################################ EventType "Talk" ################################################ + + +class TalkEventProposalForm(BaseEventProposalForm): + """ + EventProposalForm with field names and help_text adapted to talk submissions + """ + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + # 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.' + + # fix label and help_text for the abstract field + self.fields['abstract'].label = 'Abstract of Talk' + self.fields['abstract'].help_text = 'The description/abstract of this talk/presentation. Explain what the audience will experience.' + + # fix label and help_text for the submission_notes field + self.fields['submission_notes'].label = 'Talk Notes' + self.fields['submission_notes'].help_text = 'Private notes regarding this talk. Only visible to yourself and the BornHack organisers.' + + # no duration for talks + del(self.fields['duration']) + + +class TalkSpeakerProposalForm(BaseSpeakerProposalForm): + """ + SpeakerProposalForm with field labels and help_text adapted for talk submissions + """ + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + # fix label and help_text for the name field + self.fields['name'].label = 'Speaker Name' + self.fields['name'].help_text = 'The name of the speaker. Can be a real name or an alias.' + + # fix label and help_text for the biograpy field + self.fields['biography'].label = 'Speaker Biography' + self.fields['biography'].help_text = 'The biography of the speaker.' + + # fix label and help_text for the submission_notes field + self.fields['submission_notes'].label = 'Speaker Notes' + self.fields['submission_notes'].help_text = 'Private notes regarding this speaker. Only visible to yourself and the BornHack organisers.' + + +################################ EventType "Lightning Talk" ################################################ + + +class LightningTalkEventProposalForm(TalkEventProposalForm): + """ + LightningTalkEventProposalForm is identical to TalkEventProposalForm for now. Keeping the class here for easy customisation later. + """ + pass + +class LightningTalkSpeakerProposalForm(TalkSpeakerProposalForm): + """ + LightningTalkSpeakerProposalForm is identical to TalkSpeakerProposalForm except for no free tickets + """ + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + # no free tickets for lightning talks + del(self.fields['needs_oneday_ticket']) + + +################################ EventType "Workshop" ################################################ + + +class WorkshopEventProposalForm(BaseEventProposalForm): + """ + EventProposalForm with field names and help_text adapted for workshop submissions + """ + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + # 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.' + + # fix label and help_text for the submission_notes field + self.fields['submission_notes'].label = 'Workshop Notes' + self.fields['submission_notes'].help_text = 'Private notes regarding this workshop. Only visible to yourself and the BornHack organisers.' + + # fix label and help_text for the abstract field + self.fields['abstract'].label = 'Workshop Abstract' + self.fields['abstract'].help_text = 'The description/abstract of this workshop. Explain what the participants will learn.' + + # no video recording for workshops + del(self.fields['allow_video_recording']) + + # duration field + self.fields['duration'].label = 'Workshop Duration' + self.fields['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).' + +class WorkshopSpeakerProposalForm(BaseSpeakerProposalForm): + """ + SpeakerProposalForm with field labels and help_text adapted for workshop submissions + """ + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + # fix label and help_text for the name field + self.fields['name'].label = 'Host Name' + self.fields['name'].help_text = 'The name of the workshop host. Can be a real name or an alias.' + + # fix label and help_text for the biograpy field + self.fields['biography'].label = 'Host Biography' + self.fields['biography'].help_text = 'The biography of the host.' + + # fix label and help_text for the submission_notes field + self.fields['submission_notes'].label = 'Host Notes' + self.fields['submission_notes'].help_text = 'Private notes regarding this host. Only visible to yourself and the BornHack organisers.' + + # no free tickets for workshops + del(self.fields['needs_oneday_ticket']) + + +################################ EventType "Music" ################################################ + + +class MusicEventProposalForm(BaseEventProposalForm): + """ + EventProposalForm with field names and help_text adapted to music submissions + """ + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + # 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.' + + # fix label and help_text for the submission_notes field + self.fields['submission_notes'].label = 'Music Act Notes' + self.fields['submission_notes'].help_text = 'Private notes regarding this music act. Only visible to yourself and the BornHack organisers.' + + # no video recording for music acts + del(self.fields['allow_video_recording']) + + # no abstract for music acts + del(self.fields['abstract']) + + # better placeholder text for duration field + self.fields['duration'].widget.attrs['placeholder'] = 'Duration (minutes)' + + +class MusicSpeakerProposalForm(BaseSpeakerProposalForm): + """ + SpeakerProposalForm with field labels and help_text adapted for music submissions + """ + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + # fix label and help_text for the name field + self.fields['name'].label = 'Artist Name' + self.fields['name'].help_text = 'The name of the artist. Can be a real name or artist alias.' + + # fix label and help_text for the biograpy field + self.fields['biography'].label = 'Artist Description' + self.fields['biography'].help_text = 'The description of the artist.' + + # fix label and help_text for the submission_notes field + self.fields['submission_notes'].label = 'Artist Notes' + self.fields['submission_notes'].help_text = 'Private notes regarding this artist. Only visible to yourself and the BornHack organisers.' + + # no oneday tickets for music acts + del(self.fields['needs_oneday_ticket']) + + +################################ EventType "Slacking Off" ################################################ + + +class SlackEventProposalForm(BaseEventProposalForm): + """ + EventProposalForm with field names and help_text adapted to slacking off submissions + """ + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + # 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' + + # fix label and help_text for the abstract field + self.fields['abstract'].label = 'Event Abstract' + self.fields['abstract'].help_text = 'The description/abstract of this recreational event.' + + # fix label and help_text for the submission_notes field + self.fields['submission_notes'].label = 'Event Notes' + self.fields['submission_notes'].help_text = 'Private notes regarding this recreational event. Only visible to yourself and the BornHack organisers.' + + # no video recording for music acts + del(self.fields['allow_video_recording']) + + # better placeholder text for duration field + self.fields['duration'].label = 'Event Duration' + self.fields['duration'].widget.attrs['placeholder'] = 'Duration (minutes)' + + +class SlackSpeakerProposalForm(BaseSpeakerProposalForm): + """ + SpeakerProposalForm with field labels and help_text adapted for recreational events + """ + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + # fix label and help_text for the name field + self.fields['name'].label = 'Host Name' + self.fields['name'].help_text = 'The name of the event host. Can be a real name or an alias.' + + # fix label and help_text for the biograpy field + self.fields['biography'].label = 'Host Biography' + self.fields['biography'].help_text = 'The biography of the host.' + + # fix label and help_text for the submission_notes field + self.fields['submission_notes'].label = 'Host Notes' + self.fields['submission_notes'].help_text = 'Private notes regarding this host. Only visible to yourself and the BornHack organisers.' + + # no oneday tickets for music acts + del(self.fields['needs_oneday_ticket']) + diff --git a/src/program/migrations/0048_auto_20180512_1625.py b/src/program/migrations/0048_auto_20180512_1625.py new file mode 100644 index 00000000..a081dc08 --- /dev/null +++ b/src/program/migrations/0048_auto_20180512_1625.py @@ -0,0 +1,134 @@ +# Generated by Django 2.0.4 on 2018-05-12 14:25 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('camps', '0026_auto_20180506_1633'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('program', '0047_auto_20180415_1159'), + ] + + operations = [ + migrations.CreateModel( + name='EventTrack', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created', models.DateTimeField(auto_now_add=True)), + ('updated', models.DateTimeField(auto_now=True)), + ('name', models.CharField(max_length=100)), + ('slug', models.SlugField()), + ('camp', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='eventtracks', to='camps.Camp')), + ('managers', models.ManyToManyField(related_name='managed_tracks', to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.RemoveField( + model_name='speaker', + name='picture_large', + ), + migrations.RemoveField( + model_name='speaker', + name='picture_small', + ), + migrations.RemoveField( + model_name='speakerproposal', + name='picture_large', + ), + migrations.RemoveField( + model_name='speakerproposal', + name='picture_small', + ), + migrations.AddField( + model_name='eventproposal', + name='duration', + field=models.IntegerField(blank=True, default=None, help_text='How much time (in minutes) should we set aside for this act? Please keep it between 60 and 180 minutes (1-3 hours).', null=True), + ), + migrations.AddField( + model_name='eventtype', + name='description', + field=models.TextField(blank=True, default='', help_text='The description of this type of event. Used in content submission flow.'), + ), + migrations.AddField( + model_name='eventtype', + name='icon', + field=models.CharField(default='wrench', help_text="Name of the fontawesome icon to use, without the 'fa-' part", max_length=25), + ), + migrations.AddField( + model_name='eventtype', + name='oneday_ticket_possible', + field=models.BooleanField(default=False, help_text='Check if hosting an event of this type qualifies someone for a free oneday ticket'), + ), + migrations.AddField( + model_name='speaker', + name='needs_oneday_ticket', + field=models.BooleanField(default=False, help_text='Check if BornHack needs to provide a free one-day ticket for this speaker'), + ), + migrations.AddField( + model_name='speakerproposal', + name='needs_oneday_ticket', + field=models.BooleanField(default=False, help_text='Check if BornHack needs to provide a free one-day ticket for this speaker'), + ), + migrations.AlterField( + model_name='eventlocation', + name='icon', + field=models.CharField(help_text="Name of the fontawesome icon to use without the 'fa-' part", max_length=100), + ), + migrations.AlterField( + model_name='eventproposal', + name='abstract', + field=models.TextField(blank=True, help_text='The abstract for this event. Describe what the audience can expect to see/hear.'), + ), + migrations.AlterField( + model_name='eventproposal', + name='proposal_status', + field=models.CharField(choices=[('pending', 'Pending approval'), ('approved', 'Approved'), ('rejected', 'Rejected')], default='pending', max_length=50), + ), + migrations.AlterField( + model_name='eventproposal', + name='speakers', + field=models.ManyToManyField(blank=True, help_text='Pick the speaker(s) for this event. If you cannot see anything here you need to go back and create Speaker Proposal(s) first.', related_name='eventproposals', to='program.SpeakerProposal'), + ), + migrations.AlterField( + model_name='eventproposal', + name='title', + field=models.CharField(help_text='The title of this event. Keep it short and memorable.', max_length=255), + ), + migrations.AlterField( + model_name='speakerproposal', + name='biography', + field=models.TextField(help_text='Biography of the speaker/artist/host. Markdown is supported.'), + ), + migrations.AlterField( + model_name='speakerproposal', + name='name', + field=models.CharField(help_text='Name or alias of the speaker/artist/host', max_length=150), + ), + migrations.AlterField( + model_name='speakerproposal', + name='proposal_status', + field=models.CharField(choices=[('pending', 'Pending approval'), ('approved', 'Approved'), ('rejected', 'Rejected')], default='pending', max_length=50), + ), + migrations.AlterField( + model_name='speakerproposal', + name='submission_notes', + field=models.TextField(blank=True, help_text='Private notes for this speaker/artist/host. Only visible to the submitting user and the BornHack organisers.'), + ), + migrations.AddField( + model_name='event', + name='track', + field=models.ForeignKey(blank=True, help_text='The track this event belongs to', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='events', to='program.EventTrack'), + ), + migrations.AddField( + model_name='eventproposal', + name='track', + field=models.ForeignKey(blank=True, help_text='The track this event belongs to', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='eventproposals', to='program.EventTrack'), + ), + migrations.AlterUniqueTogether( + name='eventtrack', + unique_together={('camp', 'slug'), ('camp', 'name')}, + ), + ] diff --git a/src/program/migrations/0049_add_event_tracks.py b/src/program/migrations/0049_add_event_tracks.py new file mode 100644 index 00000000..d19c68ca --- /dev/null +++ b/src/program/migrations/0049_add_event_tracks.py @@ -0,0 +1,30 @@ +# Generated by Django 2.0.4 on 2018-05-12 14:29 + +from django.db import migrations + +def add_event_tracks(apps, schema_editor): + Camp = apps.get_model('camps', 'Camp') + EventTrack = apps.get_model('program', 'EventTrack') + EventProposal = apps.get_model('program', 'EventProposal') + Event = apps.get_model('program', 'Event') + for camp in Camp.objects.all(): + # create the default track for this camp + track = EventTrack.objects.create( + name="BornHack", + slug="bornhack", + camp=camp + ) + Event.objects.filter(camp=camp).update(track=track) + EventProposal.objects.filter(camp=camp).update(track=track) + + +class Migration(migrations.Migration): + + dependencies = [ + ('program', '0048_auto_20180512_1625'), + ] + + operations = [ + migrations.RunPython(add_event_tracks), + ] + diff --git a/src/program/migrations/0050_auto_20180512_1650.py b/src/program/migrations/0050_auto_20180512_1650.py new file mode 100644 index 00000000..492e8e09 --- /dev/null +++ b/src/program/migrations/0050_auto_20180512_1650.py @@ -0,0 +1,25 @@ +# Generated by Django 2.0.4 on 2018-05-12 14:50 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('program', '0049_add_event_tracks'), + ] + + operations = [ + migrations.AlterUniqueTogether( + name='event', + unique_together={('track', 'title'), ('track', 'slug')}, + ), + migrations.RemoveField( + model_name='eventproposal', + name='camp', + ), + migrations.RemoveField( + model_name='event', + name='camp', + ), + ] diff --git a/src/program/migrations/0051_auto_20180512_1801.py b/src/program/migrations/0051_auto_20180512_1801.py new file mode 100644 index 00000000..c07569ad --- /dev/null +++ b/src/program/migrations/0051_auto_20180512_1801.py @@ -0,0 +1,24 @@ +# Generated by Django 2.0.4 on 2018-05-12 16:01 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('program', '0050_auto_20180512_1650'), + ] + + operations = [ + migrations.AlterField( + model_name='event', + name='track', + field=models.ForeignKey(help_text='The track this event belongs to', on_delete=django.db.models.deletion.PROTECT, related_name='events', to='program.EventTrack'), + ), + migrations.AlterField( + model_name='eventproposal', + name='track', + field=models.ForeignKey(help_text='The track this event belongs to', on_delete=django.db.models.deletion.PROTECT, related_name='eventproposals', to='program.EventTrack'), + ), + ] diff --git a/src/program/migrations/0052_auto_20180519_2324.py b/src/program/migrations/0052_auto_20180519_2324.py new file mode 100644 index 00000000..3a1dedcb --- /dev/null +++ b/src/program/migrations/0052_auto_20180519_2324.py @@ -0,0 +1,18 @@ +# Generated by Django 2.0.4 on 2018-05-19 21:24 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('program', '0051_auto_20180512_1801'), + ] + + operations = [ + migrations.AlterField( + model_name='eventproposal', + name='allow_video_recording', + field=models.BooleanField(default=False, help_text='Check if we can video record the event. Leave unchecked to avoid video recording.'), + ), + ] diff --git a/src/program/migrations/0053_auto_20180519_2325.py b/src/program/migrations/0053_auto_20180519_2325.py new file mode 100644 index 00000000..7d70c248 --- /dev/null +++ b/src/program/migrations/0053_auto_20180519_2325.py @@ -0,0 +1,18 @@ +# Generated by Django 2.0.4 on 2018-05-19 21:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('program', '0052_auto_20180519_2324'), + ] + + operations = [ + migrations.AlterField( + model_name='eventproposal', + name='allow_video_recording', + field=models.BooleanField(default=False, help_text='Check to allow video recording of the event. Leave unchecked to avoid video recording.'), + ), + ] diff --git a/src/program/migrations/0054_auto_20180520_1509.py b/src/program/migrations/0054_auto_20180520_1509.py new file mode 100644 index 00000000..e859b9ab --- /dev/null +++ b/src/program/migrations/0054_auto_20180520_1509.py @@ -0,0 +1,22 @@ +# Generated by Django 2.0.4 on 2018-05-20 13:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('program', '0053_auto_20180519_2325'), + ] + + operations = [ + migrations.RemoveField( + model_name='eventtype', + name='oneday_ticket_possible', + ), + migrations.AddField( + model_name='eventtype', + name='host_title', + field=models.CharField(default='Person', help_text='What to call someone hosting this type of event. Like "Artist" for Music or "Speaker" for talks.', max_length=30), + ), + ] diff --git a/src/program/mixins.py b/src/program/mixins.py index 9cf00b5f..89893a2a 100644 --- a/src/program/mixins.py +++ b/src/program/mixins.py @@ -8,47 +8,36 @@ import sys import mimetypes -class EnsureCFSOpenMixin(SingleObjectMixin): +class EnsureCFPOpenMixin(object): def dispatch(self, request, *args, **kwargs): - # do not permit editing if call for speakers is not open - if not self.camp.call_for_speakers_open: - messages.error(request, "The Call for Speakers is not open.") + # do not permit this action if call for participation is not open + if not self.camp.call_for_participation_open: + messages.error(request, "The Call for Participation is not open.") return redirect( - reverse('proposal_list', kwargs={'camp_slug': self.camp.slug}) + reverse('program:proposal_list', kwargs={'camp_slug': self.camp.slug}) ) # alright, continue with the request return super().dispatch(request, *args, **kwargs) -class CreateProposalMixin(SingleObjectMixin): - def form_valid(self, form): - # set camp and user before saving - form.instance.camp = self.camp - form.instance.user = self.request.user - form.save() - return redirect( - reverse('proposal_list', kwargs={'camp_slug': self.camp.slug}) - ) - - class EnsureUnapprovedProposalMixin(SingleObjectMixin): def dispatch(self, request, *args, **kwargs): # do not permit editing if the proposal is already approved if self.get_object().proposal_status == models.UserSubmittedModel.PROPOSAL_APPROVED: messages.error(request, "This proposal has already been approved. Please contact the organisers if you need to modify something.") - return redirect(reverse('proposal_list', kwargs={'camp_slug': self.camp.slug})) + return redirect(reverse('program:proposal_list', kwargs={'camp_slug': self.camp.slug})) # alright, continue with the request return super().dispatch(request, *args, **kwargs) -class EnsureWritableCampMixin(SingleObjectMixin): +class EnsureWritableCampMixin(object): def dispatch(self, request, *args, **kwargs): # do not permit view if camp is in readonly mode if self.camp.read_only: messages.error(request, "No thanks") - return redirect(reverse('proposal_list', kwargs={'camp_slug': self.camp.slug})) + return redirect(reverse('program:proposal_list', kwargs={'camp_slug': self.camp.slug})) # alright, continue with the request return super().dispatch(request, *args, **kwargs) @@ -60,47 +49,9 @@ class EnsureUserOwnsProposalMixin(SingleObjectMixin): if self.get_object().user.username != request.user.username: messages.error(request, "No thanks") return redirect( - reverse('proposal_list', kwargs={'camp_slug': self.camp.slug}) + reverse('program:proposal_list', kwargs={'camp_slug': self.camp.slug}) ) # alright, continue with the request return super().dispatch(request, *args, **kwargs) - -class PictureViewMixin(SingleObjectMixin): - def dispatch(self, request, *args, **kwargs): - # do we have the requested picture? - if kwargs['picture'] == 'thumbnail': - if self.get_object().picture_small: - self.picture = self.get_object().picture_small - else: - raise Http404() - elif kwargs['picture'] == 'large': - if self.get_object().picture_large: - self.picture = self.get_object().picture_large - else: - raise Http404() - else: - # only 'thumbnail' and 'large' pictures supported - raise Http404() - - # alright, continue with the request - return super().dispatch(request, *args, **kwargs) - - def get_picture_response(self, path): - if 'runserver' in sys.argv or 'runserver_plus' in sys.argv: - # this is a local devserver situation, guess mimetype from extension and return picture directly - response = HttpResponse( - self.picture, - content_type=mimetypes.types_map[".%s" % self.picture.name.split(".")[-1]] - ) - else: - # make nginx serve the picture using X-Accel-Redirect - # (this works for nginx only, other webservers use x-sendfile) - # TODO: maybe make the header name configurable - response = HttpResponse() - response['X-Accel-Redirect'] = path - response['Content-Type'] = '' - return response - - diff --git a/src/program/models.py b/src/program/models.py index 04503f5b..5f4bd6ed 100644 --- a/src/program/models.py +++ b/src/program/models.py @@ -4,8 +4,7 @@ import icalendar import logging from datetime import timedelta - -from django.contrib.postgres.fields import DateTimeRangeField +from django.contrib.postgres.fields import DateTimeRangeField, ArrayField from django.contrib import messages from django.db import models from django.core.exceptions import ObjectDoesNotExist, ValidationError @@ -21,43 +20,6 @@ from utils.models import CreatedUpdatedModel, CampRelatedModel logger = logging.getLogger("bornhack.%s" % __name__) -class CustomUrlStorage(FileSystemStorage): - def __init__(self, location=None): - super(CustomUrlStorage, self).__init__(location) - - def url(self, name): - url = super(CustomUrlStorage, self).url(name) - parts = url.split("/") - if parts[0] != "public": - # first bit should always be "public" - return False - - if parts[1] == "speakerproposals": - # find speakerproposal - speakerproposal_model = apps.get_model('program', 'speakerproposal') - try: - speakerproposal = speakerproposal_model.objects.get(picture_small=name) - picture = "small" - except speakerproposal_model.DoesNotExist: - try: - speakerproposal = speakerproposal_model.objects.get(picture_large=name) - picture = "large" - except speakerproposal_model.DoesNotExist: - return False - url = reverse('speakerproposal_picture', kwargs={ - 'camp_slug': speakerproposal.camp.slug, - 'pk': speakerproposal.pk, - 'picture': picture, - }) - else: - return False - - return url - - -storage = CustomUrlStorage() - - class UserSubmittedModel(CampRelatedModel): """ An abstract model containing the stuff that is shared @@ -78,72 +40,48 @@ class UserSubmittedModel(CampRelatedModel): on_delete=models.PROTECT ) - PROPOSAL_DRAFT = 'draft' PROPOSAL_PENDING = 'pending' PROPOSAL_APPROVED = 'approved' PROPOSAL_REJECTED = 'rejected' - PROPOSAL_MODIFIED_AFTER_APPROVAL = 'modified after approval' PROPOSAL_STATUSES = [ - PROPOSAL_DRAFT, PROPOSAL_PENDING, PROPOSAL_APPROVED, PROPOSAL_REJECTED, - PROPOSAL_MODIFIED_AFTER_APPROVAL ] PROPOSAL_STATUS_CHOICES = [ - (PROPOSAL_DRAFT, 'Draft'), (PROPOSAL_PENDING, 'Pending approval'), (PROPOSAL_APPROVED, 'Approved'), (PROPOSAL_REJECTED, 'Rejected'), - (PROPOSAL_MODIFIED_AFTER_APPROVAL, 'Modified after approval'), ] proposal_status = models.CharField( max_length=50, choices=PROPOSAL_STATUS_CHOICES, - default=PROPOSAL_DRAFT, + default=PROPOSAL_PENDING, ) def __str__(self): return '%s (submitted by: %s, status: %s)' % (self.headline, self.user, self.proposal_status) def save(self, **kwargs): - if not self.camp.call_for_speakers_open: - message = 'Call for speakers is not open' + if not self.camp.call_for_participation_open: + message = 'Call for participation is not open' if hasattr(self, 'request'): messages.error(self.request, message) raise ValidationError(message) super().save(**kwargs) def delete(self, **kwargs): - if not self.camp.call_for_speakers_open: - message = 'Call for speakers is not open' + if not self.camp.call_for_participation_open: + message = 'Call for participation is not open' if hasattr(self, 'request'): messages.error(self.request, message) raise ValidationError(message) super().delete(**kwargs) -def get_speakerproposal_picture_upload_path(instance, filename): - """ We want speakerproposal pictures saved as MEDIA_ROOT/public/speakerproposals/camp-slug/proposal-uuid/filename """ - return 'public/speakerproposals/%(campslug)s/%(proposaluuid)s/%(filename)s' % { - 'campslug': instance.camp.slug, - 'proposaluuid': instance.uuid, - 'filename': filename - } - - -def get_speakersubmission_picture_upload_path(instance, filename): - """ We want speakerproposal pictures saved as MEDIA_ROOT/public/speakerproposals/camp-slug/proposal-uuid/filename """ - return 'public/speakerproposals/%(campslug)s/%(proposaluuid)s/%(filename)s' % { - 'campslug': instance.camp.slug, - 'proposaluuidd': instance.uuid, - 'filename': filename - } - - class SpeakerProposal(UserSubmittedModel): """ A speaker proposal """ @@ -155,42 +93,29 @@ class SpeakerProposal(UserSubmittedModel): name = models.CharField( max_length=150, - help_text='Name or alias of the speaker', + help_text='Name or alias of the speaker/artist/host', ) biography = models.TextField( - help_text='Markdown is supported.' - ) - - picture_large = models.ImageField( - null=True, - blank=True, - upload_to=get_speakerproposal_picture_upload_path, - help_text='A picture of the speaker', - storage=storage, - max_length=255 - ) - - picture_small = models.ImageField( - null=True, - blank=True, - upload_to=get_speakerproposal_picture_upload_path, - help_text='A thumbnail of the speaker picture', - storage=storage, - max_length=255 + help_text='Biography of the speaker/artist/host. Markdown is supported.' ) submission_notes = models.TextField( - help_text='Private notes for this speaker. Only visible to the submitting user and the BornHack organisers.', + help_text='Private notes for this speaker/artist/host. Only visible to the submitting user and the BornHack organisers.', blank=True ) + needs_oneday_ticket = models.BooleanField( + default=False, + help_text='Check if BornHack needs to provide a free one-day ticket for this speaker', + ) + @property def headline(self): return self.name def get_absolute_url(self): - return reverse_lazy('speakerproposal_detail', kwargs={'camp_slug': self.camp.slug, 'pk': self.uuid}) + return reverse_lazy('program:speakerproposal_detail', kwargs={'camp_slug': self.camp.slug, 'pk': self.uuid}) def mark_as_approved(self): speakermodel = apps.get_model('program', 'speaker') @@ -199,13 +124,7 @@ class SpeakerProposal(UserSubmittedModel): speaker.camp = self.camp speaker.name = self.name speaker.biography = self.biography - if self.picture_small and self.picture_large: - temp = ContentFile(self.picture_small.read()) - temp.name = os.path.basename(self.picture_small.name) - speaker.picture_small = temp - temp = ContentFile(self.picture_large.read()) - temp.name = os.path.basename(self.picture_large.name) - speaker.picture_large = temp + speaker.needs_oneday_ticket = self.needs_oneday_ticket speaker.proposal = self speaker.save() @@ -216,19 +135,21 @@ class SpeakerProposal(UserSubmittedModel): class EventProposal(UserSubmittedModel): """ An event proposal """ - camp = models.ForeignKey( - 'camps.Camp', + track = models.ForeignKey( + 'program.EventTrack', related_name='eventproposals', + help_text='The track this event belongs to', on_delete=models.PROTECT ) title = models.CharField( max_length=255, - help_text='The title of this event', + help_text='The title of this event. Keep it short and memorable.', ) abstract = models.TextField( - help_text='The abstract for this event' + help_text='The abstract for this event. Describe what the audience can expect to see/hear.', + blank=True, ) event_type = models.ForeignKey( @@ -241,11 +162,19 @@ class EventProposal(UserSubmittedModel): 'program.SpeakerProposal', blank=True, help_text='Pick the speaker(s) for this event. If you cannot see anything here you need to go back and create Speaker Proposal(s) first.', + related_name='eventproposals', ) allow_video_recording = models.BooleanField( default=False, - help_text='If we can video record the event or not' + help_text='Check to allow video recording of the event. Leave unchecked to avoid video recording.' + ) + + duration = models.IntegerField( + default=None, + null=True, + blank=True, + help_text='How much time (in minutes) should we set aside for this act? Please keep it between 60 and 180 minutes (1-3 hours).' ) submission_notes = models.TextField( @@ -253,16 +182,30 @@ class EventProposal(UserSubmittedModel): blank=True ) + @property + def camp(self): + return self.track.camp + @property def headline(self): return self.title def get_absolute_url(self): return reverse_lazy( - 'eventproposal_detail', + 'program:eventproposal_detail', kwargs={'camp_slug': self.camp.slug, 'pk': self.uuid} ) + def get_available_speakerproposals(self): + """ + Return all SpeakerProposals submitted by the user who submitted this EventProposal, + which are not already added to this EventProposal + """ + return SpeakerProposal.objects.filter( + camp=self.track.camp, + user=self.user + ).exclude(uuid__in=self.speakers.all().values_list('uuid')) + def mark_as_approved(self): eventmodel = apps.get_model('program', 'event') eventproposalmodel = apps.get_model('program', 'eventproposal') @@ -285,9 +228,37 @@ class EventProposal(UserSubmittedModel): self.proposal_status = eventproposalmodel.PROPOSAL_APPROVED self.save() + ############################################################################### +class EventTrack(CampRelatedModel): + """ All events belong to a track. Administration of a track can be delegated to one or more users. """ + + name = models.CharField( + max_length=100 + ) + + slug = models.SlugField() + + camp = models.ForeignKey( + 'camps.Camp', + related_name='eventtracks', + on_delete=models.PROTECT + ) + + managers = models.ManyToManyField( + 'auth.User', + related_name='managed_tracks', + ) + + def __str__(self): + return self.name + + class Meta: + unique_together = (('camp', 'slug'), ('camp', 'name')) + + class EventLocation(CampRelatedModel): """ The places where stuff happens """ @@ -299,7 +270,7 @@ class EventLocation(CampRelatedModel): icon = models.CharField( max_length=100, - help_text="hex for the unicode character in the fontawesome icon set to use, like 'f000' for 'fa-glass'" + help_text="Name of the fontawesome icon to use without the 'fa-' part" ) camp = models.ForeignKey( @@ -332,6 +303,12 @@ class EventType(CreatedUpdatedModel): slug = models.SlugField() + description = models.TextField( + default='', + help_text='The description of this type of event. Used in content submission flow.', + blank=True, + ) + color = models.CharField( max_length=50, help_text='The background color of this event type', @@ -342,6 +319,12 @@ class EventType(CreatedUpdatedModel): help_text='Check if this event type should use white text color', ) + icon = models.CharField( + max_length=25, + help_text="Name of the fontawesome icon to use, without the 'fa-' part", + default='wrench', + ) + notifications = models.BooleanField( default=False, help_text='Check to send notifications for this event type', @@ -357,6 +340,12 @@ class EventType(CreatedUpdatedModel): help_text='Include events of this type in the event list?', ) + host_title = models.CharField( + max_length=30, + help_text='What to call someone hosting this type of event. Like "Artist" for Music or "Speaker" for talks.', + default='Person', + ) + def __str__(self): return self.name @@ -393,10 +382,10 @@ class Event(CampRelatedModel): help_text='The slug for this event, created automatically', ) - camp = models.ForeignKey( - 'camps.Camp', + track = models.ForeignKey( + 'program.EventTrack', related_name='events', - help_text='The camp this event belongs to', + help_text='The track this event belongs to', on_delete=models.PROTECT ) @@ -422,7 +411,7 @@ class Event(CampRelatedModel): class Meta: ordering = ['title'] - unique_together = (('camp', 'slug'), ('camp', 'title')) + unique_together = (('track', 'slug'), ('track', 'title')) def __str__(self): return '%s (%s)' % (self.title, self.camp.title) @@ -432,6 +421,10 @@ class Event(CampRelatedModel): self.slug = slugify(self.title) super(Event, self).save(**kwargs) + @property + def camp(self): + return self.track.camp + @property def speakers_list(self): if self.speakers.exists(): @@ -439,7 +432,7 @@ class Event(CampRelatedModel): return False def get_absolute_url(self): - return reverse_lazy('event_detail', kwargs={'camp_slug': self.camp.slug, 'slug': self.slug}) + return reverse_lazy('program:event_detail', kwargs={'camp_slug': self.camp.slug, 'slug': self.slug}) def serialize(self): data = { @@ -514,9 +507,7 @@ class EventInstance(CampRelatedModel): @property def timeslots(self): - """ - Find the number of timeslots this eventinstance takes up - """ + """ Find the number of timeslots this eventinstance takes up """ seconds = (self.when.upper-self.when.lower).seconds minutes = seconds / 60 return minutes / settings.SCHEDULE_TIMESLOT_LENGTH_MINUTES @@ -564,15 +555,6 @@ class EventInstance(CampRelatedModel): return data -def get_speaker_picture_upload_path(instance, filename): - """ We want speaker pictures are saved as MEDIA_ROOT/public/speakers/camp-slug/speaker-slug/filename """ - return 'public/speakers/%(campslug)s/%(speakerslug)s/%(filename)s' % { - 'campslug': instance.camp.slug, - 'speakerslug': instance.slug, - 'filename': filename - } - - class Speaker(CampRelatedModel): """ A Person (co)anchoring one or more events on a camp. """ @@ -585,20 +567,6 @@ class Speaker(CampRelatedModel): help_text='Markdown is supported.' ) - picture_small = models.ImageField( - null=True, - blank=True, - upload_to=get_speaker_picture_upload_path, - help_text='A thumbnail of the speaker picture' - ) - - picture_large = models.ImageField( - null=True, - blank=True, - upload_to=get_speaker_picture_upload_path, - help_text='A picture of the speaker' - ) - slug = models.SlugField( blank=True, max_length=255, @@ -628,6 +596,11 @@ class Speaker(CampRelatedModel): on_delete=models.PROTECT ) + needs_oneday_ticket = models.BooleanField( + default=False, + help_text='Check if BornHack needs to provide a free one-day ticket for this speaker', + ) + class Meta: ordering = ['name'] unique_together = (('camp', 'name'), ('camp', 'slug')) @@ -641,16 +614,7 @@ class Speaker(CampRelatedModel): super(Speaker, self).save(**kwargs) def get_absolute_url(self): - return reverse_lazy('speaker_detail', kwargs={'camp_slug': self.camp.slug, 'slug': self.slug}) - - def get_picture_url(self, size): - return reverse('speaker_picture', kwargs={'camp_slug': self.camp.slug, 'slug': self.slug, 'picture': size}) - - def get_small_picture_url(self): - return self.get_picture_url('thumbnail') - - def get_large_picture_url(self): - return self.get_picture_url('large') + return reverse_lazy('program:speaker_detail', kwargs={'camp_slug': self.camp.slug, 'slug': self.slug}) def serialize(self): data = { @@ -658,11 +622,6 @@ class Speaker(CampRelatedModel): 'slug': self.slug, 'biography': self.biography, } - - if self.picture_small and self.picture_large: - data['large_picture_url'] = self.get_large_picture_url() - data['small_picture_url'] = self.get_small_picture_url() - return data @@ -680,3 +639,33 @@ class Favorite(models.Model): class Meta: unique_together = ['user', 'event_instance'] +# classes and functions below here was used by picture handling for speakers before it was removed in May 2018 by tyk + +class CustomUrlStorage(FileSystemStorage): + """ + Must exist because it is mentioned in old migrations. + Can be removed when we clean up old migrations at some point + """ + pass + +def get_speaker_picture_upload_path(): + """ + Must exist because it is mentioned in old migrations. + Can be removed when we clean up old migrations at some point + """ + pass + +def get_speakerproposal_picture_upload_path(): + """ + Must exist because it is mentioned in old migrations. + Can be removed when we clean up old migrations at some point + """ + pass + +def get_speakersubmission_picture_upload_path(): + """ + Must exist because it is mentioned in old migrations. + Can be removed when we clean up old migrations at some point + """ + pass + diff --git a/src/program/templates/bornhack-2016_call_for_participation.html b/src/program/templates/bornhack-2016_call_for_participation.html new file mode 100644 index 00000000..7d47f74e --- /dev/null +++ b/src/program/templates/bornhack-2016_call_for_participation.html @@ -0,0 +1,56 @@ +{% extends 'program_base.html' %} + +{% block title %} +Call for Speakers | {{ block.super }} +{% endblock %} + +{% block program_content %} + +{% if not camp.call_for_participation_open %} +
+ Note! This Call for Speakers is no longer relevant. It is kept here for historic purposes. +
+{% endif %} + +

BornHack 2016: Call for Speakers

+ +

BornHack 2016 is a 7 days outdoor technology tent camping festival that will take place from the 27th of August to the 3rd of September 2016 on the island of Bornholm in Denmark. It is first time that BornHack will take place and it is our goal to make BornHack a yearly recurring event with 100 to 350 participants.

+ +

We are looking for gifted, entertaining and technically enlightening speakers to host talks, lightning talks and workshops at BornHack.

+ +

Please reach out to us on speakers@bornhack.dk with a title, abstract, biography, an optional picture of yourself and whether it is a regular talk, lightning talk, workshop or something entirely different. Please ensure that all information is in English. The submitted information will be published both as a news entry and in the official event program on our website, if the submission is accepted.

+ +

We are very open to different topics. We expect that the majority of the presentation at BornHack will be on security, networking, programming, distributed systems, privacy, and how these technologies relate to society.

+ +

The ticket shop for BornHack 2016 is already open and available at https://bornhack.dk/shop/ - please make sure you have also read our Code of Conduct.

+ +

Regular Talk

+ +

Regular talks are 45 minutes of presentation, 10 minutes of questions from the audience followed by 5 minutes of preparation for setting up the next speaker.

+ +

Please bring your own laptop with your presentation on; it should have an HDMI socket and we will provide the cable to the projector. We do not guarantee that audio will work, even if your laptop supports that.

+ +

We will provide you with a one-day entrance ticket free of charge, but due to our limited funds, you would have to pay for transportation to and from the event yourself. We also encourage you to participate for the entire week, but you would also have to pay for the ticket yourself.

+ +

Lightning Talk

+ +

Lightning talks are 10 minutes of presentation. A laptop will be connected to the projector at the location of the presentations.

+ +

A lightning talk is an excellent opportunity for inexperienced speakers to present a topic that you find interesting.

+ +

You MUST buy yourself an entrance ticket to host a lightning talk; we are unable to offer free tickets for everyone that gives a lightning talk.

+ +

Workshop

+ +

We have two workshop areas that will be able to host workshops for approximately 20 people per room. Workshops can be up to 3 hours per slot and can be extended for daily workshops.

+ +

You MUST buy yourself an entrance ticket to host a workshop; we are unable to offer free tickets for everyone that hosts a workshop.

+ +

Contact Information

+ +

The BornHack speakers team can be contacted via speakers@bornhack.dk - for general information reach out to the info team via info@bornhack.dk

+ +

We are also reachable via IRC in #BornHack on irc.baconsvin.org or 6nbtgccn5nbcodn3.onion - both listening for TLS connections on port 6697.

+ +

For more information, please have a look at https://bornhack.dk/ or follow us on Twitter at @bornhax.

+{% endblock %} diff --git a/src/program/templates/bornhack-2017_call_for_participation.html b/src/program/templates/bornhack-2017_call_for_participation.html new file mode 100644 index 00000000..f94cba5d --- /dev/null +++ b/src/program/templates/bornhack-2017_call_for_participation.html @@ -0,0 +1,58 @@ +{% extends 'program_base.html' %} + +{% block title %} +Call for Speakers | {{ block.super }} +{% endblock %} + +{% block program_content %} + +{% if not camp.call_for_participation_open %} +
+ Note! This Call for Speakers is no longer relevant. It is kept here for historic purposes. +
+{% endif %} + +

Call for Speakers

+

We are looking for gifted, talented, humourous, technically enlightened speakers to host talks, lightning talks, and workshops at BornHack.

+ +

We are very open to different topics. We expect that the majority of the presentation at BornHack will be on security, networking, programming, distributed systems, privacy, and how these technologies relate to society.

+ +

BornHack is trying to be an inclusive event so please make sure you have read and understood our Code of Conduct.

+ +

Regular Talk

+

Regular talks are 45 minutes of presentation, 10 minutes of questions from the audience followed by 5 minutes of preparation for setting up the next speaker.

+ +

Please bring your own laptop with your presentation on; it should have an ordinary HDMI output and we will provide the cable to the projector. We do not guarantee that audio will work, even if your laptop supports it - please reach out to us early if this is a requirement.

+ +

We will provide speakers with a one-day entrance ticket free of charge, but due to our limited funds, you would have to pay for transportation to and from the event yourself. We also encourage speakers to participate for the entire week, but you will have to pay for the full ticket yourself.

+ +

Lightning Talk

+

Lightning talks are 10 minutes of presentation. A laptop will be connected to the projector at the location of the presentations.

+ +

A lightning talk is an excellent opportunity for inexperienced speakers to share an interesting idea, presentation, or maybe just a small story.

+ +

You must buy an entrance ticket to host a lightning talk; we are unable to offer free tickets for lightning talks.

+ +

Workshops

+

We have two workshop areas that will be able to host workshops for approximately 20 people per room. Workshops can be up to 3 hours per slot and can be extended to full day workshops.

+ +

You must buy an entrance ticket to host a workshop; we are unable to offer free tickets for workshops.

+ +

Submitting Content

+

Please submit content for BornHack 2017 as early as possible. You can submit content via our website:

+ +
    +
  1. Create a user account on the BornHack website
  2. +
  3. Visit the proposals page
  4. +
  5. Propose a new speaker
  6. +
  7. Propose a new event
  8. +
+ +

We will review incoming proposals and notify you as early as possible on whether the proposal was accepted or not. Proposals submitted before 1st of July will be notified by us no later than the 16th of July. Late submissions are welcome, but we might be running low on available slots at that time.

+ +

Contact Information

+

The BornHack content team can be reached at content@bornhack.dk - for general questions regarding the event please reach out to the info team at info@bornhack.dk

+ +

We are reachable via IRC in #BornHack on irc.baconsvin.org (6nbtgccn5nbcodn3.onion) on port 6697 with TLS, you can also follow us on Twitter at @bornhax.

+ +{% endblock %} diff --git a/src/program/templates/bornhack-2018_call_for_participation.html b/src/program/templates/bornhack-2018_call_for_participation.html new file mode 100644 index 00000000..665d6033 --- /dev/null +++ b/src/program/templates/bornhack-2018_call_for_participation.html @@ -0,0 +1,11 @@ +{% extends 'program_base.html' %} + +{% block title %} +Call for Participation | {{ block.super }} +{% endblock %} + +{% block program_content %} + +

Call for Participation coming soon!

+ +{% endblock %} diff --git a/src/program/templates/bornhack-2019_call_for_participation.html b/src/program/templates/bornhack-2019_call_for_participation.html new file mode 100644 index 00000000..4a5180a5 --- /dev/null +++ b/src/program/templates/bornhack-2019_call_for_participation.html @@ -0,0 +1 @@ +program/templates/bornhack-2019_call_for_speakers.html \ No newline at end of file diff --git a/src/program/templates/combined_proposal_submit.html b/src/program/templates/combined_proposal_submit.html new file mode 100644 index 00000000..aed9a73d --- /dev/null +++ b/src/program/templates/combined_proposal_submit.html @@ -0,0 +1,16 @@ +{% extends 'program_base.html' %} +{% load bootstrap3 %} + +{% block program_content %} +

Submit {{ camp.title }} {{ eventtype.name }}

+ +
+ {% csrf_token %} + {% for field in form %} + {% bootstrap_field field %} + {% endfor %} + {% bootstrap_button "Submit for Review" button_type="submit" button_class="btn-primary" %} +
+ +{% endblock program_content %} + diff --git a/src/program/templates/event_list.html b/src/program/templates/event_list.html index e1d53a74..fdec3328 100644 --- a/src/program/templates/event_list.html +++ b/src/program/templates/event_list.html @@ -21,16 +21,16 @@ {% if event.event_type.include_in_event_list %} - + {{ event.event_type.name }} - {{ event.title }} + {{ event.title }} {% for speaker in event.speakers.all %} - {{ speaker.name }}
+ {{ speaker.name }}
{% empty %} N/A {% endfor %} diff --git a/src/program/templates/event_proposal_add_person.html b/src/program/templates/event_proposal_add_person.html new file mode 100644 index 00000000..da768d46 --- /dev/null +++ b/src/program/templates/event_proposal_add_person.html @@ -0,0 +1,15 @@ +{% extends 'program_base.html' %} +{% load bootstrap3 %} + +{% block program_content %} +

Add {{ eventproposal.event_type.host_title }} {{ speakerproposal.name }} to {{ eventproposal.title }}

+ +

Really add {{ speakerproposal.name }} as {{ eventproposal.event_type.host_title }} for {{ eventproposal.title }}? +

+ {% csrf_token %} + {% bootstrap_form form %} + {% bootstrap_button " Yes" button_type="submit" button_class="btn-success" %} + Cancel +
+{% endblock program_content %} + diff --git a/src/program/templates/event_proposal_select_person.html b/src/program/templates/event_proposal_select_person.html new file mode 100644 index 00000000..15597597 --- /dev/null +++ b/src/program/templates/event_proposal_select_person.html @@ -0,0 +1,33 @@ +{% extends 'program_base.html' %} + +{% block title %} +Add {{ eventproposal.event_type.host_title }} to {{ eventproposal.title }} | {{ block.super }} +{% endblock %} + +{% block program_content %} + +

Add New {{ eventproposal.event_type.host_title }} to {{ eventproposal.title }}

+ +

You are adding a new {{ eventproposal.event_type.host_title }} to {{ eventproposal.title }}. Either pick an existing {{ eventproposal.event_type.host_title }} from the list below, or press the button to create a new {{ eventproposal.event_type.host_title }}.

+ +
+
+

Existing Artists

+
+
+
+ {% for speakerproposal in speakerproposal_list %} + +

+ Add {{ speakerproposal.name }} to {{ eventproposal.title }} +

+
+ {% endfor %} +
+
+
+ + Add New {{ eventproposal.event_type.host_title }} + Cancel +{% endblock %} + diff --git a/src/program/templates/event_proposal_type_select.html b/src/program/templates/event_proposal_type_select.html new file mode 100644 index 00000000..40e730e0 --- /dev/null +++ b/src/program/templates/event_proposal_type_select.html @@ -0,0 +1,10 @@ +{% extends 'program_base.html' %} + +{% block title %} +Select Event Type | {{ block.super }} +{% endblock %} + +{% block program_content %} +{% include 'includes/event_proposal_type_select.html' %} +{% endblock %} + diff --git a/src/program/templates/event_type_select.html b/src/program/templates/event_type_select.html new file mode 100644 index 00000000..40e730e0 --- /dev/null +++ b/src/program/templates/event_type_select.html @@ -0,0 +1,10 @@ +{% extends 'program_base.html' %} + +{% block title %} +Select Event Type | {{ block.super }} +{% endblock %} + +{% block program_content %} +{% include 'includes/event_proposal_type_select.html' %} +{% endblock %} + diff --git a/src/program/templates/eventproposal_detail.html b/src/program/templates/eventproposal_detail.html index d1988d18..f2c7b01e 100644 --- a/src/program/templates/eventproposal_detail.html +++ b/src/program/templates/eventproposal_detail.html @@ -18,7 +18,7 @@

- Back to List + Back to List

{% endblock program_content %} diff --git a/src/program/templates/eventproposal_form.html b/src/program/templates/eventproposal_form.html index 26a36643..c806a7ba 100644 --- a/src/program/templates/eventproposal_form.html +++ b/src/program/templates/eventproposal_form.html @@ -2,12 +2,15 @@ {% load bootstrap3 %} {% block program_content %} -

{% if object %}Update{% else %}Create{% endif %} {{ camp.title }} Event Proposal

+{% if speaker %} +

Submit new {{ event_type.name }} by {{ speaker.name }}

+{% else %} +

{% if object %}Update{% else %}Create{% endif %} {{ camp.title }} {{ event_type.name }}

+{% endif %}
{% csrf_token %} {% bootstrap_form form %} - {% bootstrap_button "Save draft" button_type="submit" button_class="btn-primary" %} + {% bootstrap_button "Submit for Review" button_type="submit" button_class="btn-primary" %}
- {% endblock program_content %} diff --git a/src/program/templates/eventproposal_submit.html b/src/program/templates/eventproposal_submit.html deleted file mode 100644 index 25d4d6ea..00000000 --- a/src/program/templates/eventproposal_submit.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends 'program_base.html' %} -{% load bootstrap3 %} - -{% block program_content %} -

Confirm Submission

-
- {% csrf_token %} - {% bootstrap_form form %} -

Really submit this event proposal for approval?

- {% bootstrap_button "Submit" button_type="submit" button_class="btn-primary" %} -
- -{% endblock program_content %} - diff --git a/src/program/templates/includes/event_proposal_type_select.html b/src/program/templates/includes/event_proposal_type_select.html new file mode 100644 index 00000000..c335be58 --- /dev/null +++ b/src/program/templates/includes/event_proposal_type_select.html @@ -0,0 +1,30 @@ +
+
+

Submit New Proposal{% if speaker %} for {{ speaker.name }}{% endif %}

+
+
+

What would {% if speaker %}{{ speaker.name }}{% else %}you{% endif %} like to host?

+ {% if speaker %} +

You are submitting a new proposal for {{ speaker.name }}. Please begin by selecting the type of proposal below:

+ {% else %} +

To submit content for {{ camp.title }} please begin by selecting the type of event below:

+ {% endif %} + +

If you have questions or experience problems submitting proposals here please let us know on IRC or by mail. You can also send an email with your proposal and the Content team will take care of creating it in the system.

+
+
+ diff --git a/src/program/templates/includes/program_menu.html b/src/program/templates/includes/program_menu.html new file mode 100644 index 00000000..f83b03bb --- /dev/null +++ b/src/program/templates/includes/program_menu.html @@ -0,0 +1,10 @@ + Schedule + Events + Speakers + {% if camp.call_for_participation_open %} + Call for Participation + {% if request.user.is_authenticated %} + Submit Proposal + {% endif %} + {% endif %} + diff --git a/src/program/templates/noscript_schedule_view.html b/src/program/templates/noscript_schedule_view.html index c1dfdda5..af36423b 100644 --- a/src/program/templates/noscript_schedule_view.html +++ b/src/program/templates/noscript_schedule_view.html @@ -26,7 +26,7 @@ {{ instance.when.lower|date:"H:i" }}-{{ instance.when.upper|date:"H:i" }} - {{ instance.event.title }} + {{ instance.event.title }} {{ instance.location.name }} {% endfor %} diff --git a/src/program/templates/program_base.html b/src/program/templates/program_base.html index 64887332..13d6d3e2 100644 --- a/src/program/templates/program_base.html +++ b/src/program/templates/program_base.html @@ -6,20 +6,10 @@
- Schedule - Events - Speakers - {% if request.user.is_authenticated %} - Your Proposals - {% endif %} + {% include 'includes/program_menu.html' %}

diff --git a/src/program/templates/proposal_delete.html b/src/program/templates/proposal_delete.html new file mode 100644 index 00000000..489cabcb --- /dev/null +++ b/src/program/templates/proposal_delete.html @@ -0,0 +1,19 @@ +{% extends 'program_base.html' %} +{% load bootstrap3 %} + +{% block program_content %} +{% if object.name %} +

Delete "{{ object.name }}"

+{% else %} +

Delete "{{ object.title }}"

+{% endif %} +

Really delete this proposal? This action cannot be undone.

+ +
+ {% csrf_token %} + {% bootstrap_button " Delete" button_type="submit" button_class="btn-danger" %} + {% bootstrap_button " Cancel" button_type="link" button_class="btn-primary" %} +
+ +{% endblock program_content %} + diff --git a/src/program/templates/proposal_list.html b/src/program/templates/proposal_list.html index 35221261..bd21a8b0 100644 --- a/src/program/templates/proposal_list.html +++ b/src/program/templates/proposal_list.html @@ -5,98 +5,118 @@ Proposals | {{ block.super }} {% endblock %} {% block program_content %} -

Submitting

-

To submit a talk or other event for {{ camp.title }} you need to to the following:

-
    -
  1. First you propose one or more speakers. Most events just have one speaker, but some events might have two or more. Be sure to create everyone before going on to step 2.
  2. -
  3. Then you propose one or more events. The Propose New Event form will allow you to choose the speaker(s) you proposed.
  4. -
+{% include 'includes/event_proposal_type_select.html' %} -

If you experience problems submitting proposals here please let us know on IRC or by mail. You can also send an email with your proposal and the Content team will take care of creating it in the system.

+{% if speakerproposal_list or eventproposal_list %} +
+
+

Existing Proposals

+
+
+
+

People

+ {% if speakerproposal_list %} + + + + + + + + + + + {% for speakerproposal in speakerproposal_list %} + + + + + + + {% endfor %} + +
NameEventsStatusAvailable Actions
{{ speakerproposal.name }} + {% if speakerproposal.eventproposals.all %} + {% for ep in speakerproposal.eventproposals.all %} + + {% endfor %} + {% else %} + N/A + {% endif %} + {{ speakerproposal.proposal_status }} + {% if not camp.read_only %} + Modify + Add Event + {% if not speakerproposal.eventproposals.all %} + Delete + {% endif %} + {% endif %} +
+ {% else %} + Nothing found. + {% endif %} -

Your {{ camp.title }} Speaker Proposals

-{% if speakerproposal_list %} - - - - - - - - - - {% for speakerproposal in speakerproposal_list %} - - - - - - {% endfor %} - -
NameStatusActions
{{ speakerproposal.name }}{{ speakerproposal.proposal_status }} - Details - {% if not camp.read_only %} - Modify - {% if speakerproposal.proposal_status == "pending" or speakerproposal.proposal_status == "approved" %} - Submit - {% else %} - Submit - {% endif %} - Delete - {% endif %} -
-{% else %} -

No speaker proposals found

-{% endif %} +


-{% if not camp.read_only and camp.call_for_speakers_open %} -Propose New Speaker -{% endif %} - -

-
-

- -

Your {{ camp.title }} Event Proposals

-{% if eventproposal_list %} - - - - - - - - - - - {% for eventproposal in eventproposal_list %} - - - - - - - {% endfor %} - -
TitleTypeStatusActions
{{ eventproposal.title }}{{ eventproposal.event_type }}{{ eventproposal.proposal_status }} - Details - {% if not camp.read_only %} - Modify - {% if eventproposal.proposal_status == "pending" %} - Submit - {% else %} - Submit - {% endif %} - Delete - {% endif %} -
-{% else %} -

No event proposals found

-{% endif %} - -{% if not camp.read_only and camp.call_for_speakers_open %} - Propose New Event +

Events

+ {% if eventproposal_list %} + + + + + + + + + + + + + {% for eventproposal in eventproposal_list %} + + + + + + + + + {% endfor %} + +
TitleTypePeopleTrackStatusAvailable Actions
{{ eventproposal.title }} {{ eventproposal.event_type }}{% for person in eventproposal.speakers.all %} {% endfor %}{{ eventproposal.track.name }}{{ eventproposal.proposal_status }} + {% if not camp.read_only %} + Modify + {% if eventproposal.get_available_speakerproposals.exists %} + Add {{ eventproposal.event_type.host_title }} + {% else %} + Add {{ eventproposal.event_type.host_title }} + {% endif %} + Delete + {% endif %} +
+ {% else %} + Nothing found. + {% endif %} +
+
+
+
+

Status Help

+
+
+
+
pending
+
Submission is pending review from the Content Team.

+
approved
+
Submission was approved and will be part of this years camp.

+
rejected
+
Submission was not approved.
+
+
+
+
+
{% endif %} {% endblock %} diff --git a/src/program/templates/schedule_base.html b/src/program/templates/schedule_base.html index a7b3ebd7..063af2ce 100644 --- a/src/program/templates/schedule_base.html +++ b/src/program/templates/schedule_base.html @@ -31,8 +31,8 @@
- ICS + ICS
@@ -88,7 +88,7 @@
-{% url 'schedule_index' camp_slug=camp.slug as baseurl %} +{% url 'program:schedule_index' camp_slug=camp.slug as baseurl %} diff --git a/src/tickets/templates/ticket_list.html b/src/tickets/templates/ticket_list.html index 07380234..8e7dccc0 100644 --- a/src/tickets/templates/ticket_list.html +++ b/src/tickets/templates/ticket_list.html @@ -40,11 +40,11 @@ Not yet {% endif %} - Download PDF + Download PDF {% if not ticket.name %} - Set name + Set name {% else %} - Edit name + Edit name {% endif %} {% endfor %} diff --git a/src/utils/management/commands/bootstrap-devsite.py b/src/utils/management/commands/bootstrap-devsite.py index ca982bd9..29df775a 100644 --- a/src/utils/management/commands/bootstrap-devsite.py +++ b/src/utils/management/commands/bootstrap-devsite.py @@ -15,7 +15,8 @@ from program.models import ( Event, EventInstance, Speaker, - EventLocation + EventLocation, + EventTrack, ) from tickets.models import ( TicketType @@ -85,9 +86,11 @@ class Command(BaseCommand): camp2018 = Camp.objects.create( title='BornHack 2018', - tagline='Undecided', + tagline='scale it', slug='bornhack-2018', shortslug='bh2018', + call_for_participation_open=True, + call_for_sponsors_open=True, buildup=( timezone.datetime(2018, 8, 25, 12, 0, tzinfo=timezone.utc), timezone.datetime(2018, 8, 27, 11, 59, tzinfo=timezone.utc), @@ -278,26 +281,57 @@ class Command(BaseCommand): self.output("Creating event types...") workshop = EventType.objects.create( - name='Workshops', - slug='workshops', + name='Workshop', + slug='workshop', color='#ff9900', light_text=False, - public=True + public=True, + description='Workshops actively involve the participants in the learning experience', + icon='toolbox', + host_title='Host', ) talk = EventType.objects.create( - name='Talks', - slug='talks', + name='Talk', + slug='talk', color='#2D9595', light_text=True, - public=True + public=True, + description='A presentation on a stage', + icon='chalkboard-teacher', + host_title='Speaker', + ) + + lightning = EventType.objects.create( + name='Lightning Talk', + slug='lightning-talk', + color='#ff0000', + light_text=True, + public=True, + description='A short 5-10 minute presentation', + icon='bolt', + host_title='Speaker', + ) + + music = EventType.objects.create( + name='Music Act', + slug='music', + color='#1D0095', + light_text=True, + public=True, + description='A musical performance', + icon='music', + host_title='Artist', ) keynote = EventType.objects.create( - name='Keynotes', - slug='keynotes', + name='Keynote', + slug='keynote', color='#FF3453', - light_text=True + light_text=True, + description='A keynote presentation', + icon='star', + host_title='Speaker', ) facility = EventType.objects.create( @@ -306,13 +340,20 @@ class Command(BaseCommand): color='#cccccc', light_text=False, include_in_event_list=False, + description='Events involving facilities like bathrooms, food area and so on', + icon='home', + host_title='Host', ) slack = EventType.objects.create( - name='Slacking Off', - slug='slacking-off', + name='Recreational Event', + slug='recreational-event', color='#0000ff', - light_text=True + light_text=True, + public=True, + description='Events of a recreational nature', + icon='dice', + host_title='Host', ) self.output("Creating productcategories...") @@ -523,6 +564,13 @@ class Command(BaseCommand): ) order3.mark_as_paid(request=None) + self.output('Creating eventtracks for {}...'.format(year)) + track = EventTrack.objects.create( + camp=camp, + name="BornHack", + slug=camp.slug, + ) + self.output('Creating eventlocations for {}...'.format(year)) speakers_tent = EventLocation.objects.create( name='Speakers Tent', @@ -566,61 +614,61 @@ class Command(BaseCommand): title='Developing the BornHack website', abstract='abstract here, bla bla bla', event_type=talk, - camp=camp + track=track ) ev2 = Event.objects.create( title='State of the world', abstract='abstract here, bla bla bla', event_type=keynote, - camp=camp + track=track ) ev3 = Event.objects.create( title='Welcome to bornhack!', abstract='abstract here, bla bla bla', event_type=talk, - camp=camp + track=track ) ev4 = Event.objects.create( title='bar is open', abstract='the bar is open, yay', event_type=facility, - camp=camp + track=track ) ev5 = Event.objects.create( title='Network something', abstract='abstract here, bla bla bla', event_type=talk, - camp=camp + track=track ) ev6 = Event.objects.create( title='State of outer space', abstract='abstract here, bla bla bla', event_type=talk, - camp=camp + track=track ) ev9 = Event.objects.create( title='The Alternative Welcoming', abstract='Why does The Alternative support BornHack? Why does The Alternative think IT is an overlooked topic? A quick runt-hrough of our program and workshops. We will bring an IT political debate to both the stage and the beer tents.', event_type=talk, - camp=camp + track=track ) ev10 = Event.objects.create( title='Words and Power - are we making the most of online activism?', abstract='For years, big names like Ed Snowden and Chelsea Manning have given up their lives in order to protect regular people like you and me from breaches of our privacy. But we are still struggling with getting people interested in internet privacy. Why is this, and what can we do? Using experience from communicating privacy issues on multiple levels for a couple of years, I have encountered some deep seated issues in the way we talk about what privacy means. Are we good enough at letting people know whats going on?', event_type=keynote, - camp=camp + track=track ) ev11 = Event.objects.create( title='r4d1o hacking 101', abstract='Learn how to enable the antenna part of your ccc badge and get started with receiving narrow band FM. In the workshop you will have the opportunity to sneak peak on the organizers radio communications using your SDR. If there is more time we will look at WiFi radar or your protocol of choice.', event_type=workshop, - camp=camp + track=track ) ev12 = Event.objects.create( title='Introduction to Sustainable Growth in a Digital World', abstract='Free Choice is the underestimated key to secure value creation in a complex economy, where GDP-models only measure commercial profit and ignore the environment. We reconstruct the model thinking about Utility, Production, Security and Environment around the 5 Criteria for Sustainability.', event_type=workshop, - camp=camp + track=track ) ev13 = Event.objects.create( title='American Fuzzy Lop and Address Sanitizer', @@ -632,7 +680,7 @@ Code written in C and C++ is often riddled with bugs in the memory management. O Slides: [https://www.int21.de/slides/bornhack2016-fuzzing/](https://www.int21.de/slides/bornhack2016-fuzzing/) ''', event_type=talk, - camp=camp + track=track ) ev14 = Event.objects.create( title='PGP Keysigning Party', @@ -647,7 +695,7 @@ For people who haven't attended a PGP keysigning party before, we will guide you 2. (Optional) Bring some government-issued identification paper (passport, drivers license, etc.). The ID should contain a picture of yourself. You can leave this out, but then it will be a bit harder for others to verify your key properly. ''', event_type=workshop, - camp=camp + track=track ) ev15 = Event.objects.create( title='Bluetooth Low Energy', @@ -677,7 +725,7 @@ of applications you can build on top. Finally, a low-level demonstration of interfacing with a BLE controller is performed. ''', event_type=talk, - camp=camp + track=track ) ev16 = Event.objects.create( title='TLS attacks and the burden of faulty TLS implementations', @@ -699,13 +747,13 @@ underappreciated problem. Slides: [https://www.int21.de/slides/bornhack2016-tls/](https://www.int21.de/slides/bornhack2016-tls/) ''', event_type=talk, - camp=camp + track=track ) ev17 = Event.objects.create( title='State of the Network', abstract='Come and meet the network team who will talk about the design and operation of the network at BornHack.', event_type=talk, - camp=camp + track=track ) ev18 = Event.objects.create( title='Running Exit Nodes in the North', @@ -733,19 +781,19 @@ In Finland, Juha Nurmi has been establishing good relationships with ISPs and law enforcement agencies to keep Finnish exit nodes online. ''', event_type=talk, - camp=camp + track=track ) ev19 = Event.objects.create( title='Hacker Jeopardy Qualifier', abstract='Hacker Jeopardy qualifying', event_type=slack, - camp=camp + track=track ) ev20 = Event.objects.create( title='Hacker Jeopardy Finals', abstract='Hacker Jeopardy Finals between the winners of the qualifying games', event_type=slack, - camp=camp + track=track ) ev21 = Event.objects.create( title='Incompleteness Phenomena in Mathematics: From Kurt Gödel to Harvey Friedman', @@ -763,7 +811,7 @@ discovered and many of these (relative) unprovable sentences are of genuine math Note that these (early 20th century) developments also play an important role in developing the theoretical computer. ''', event_type=talk, - camp=camp + track=track ) ev22 = Event.objects.create( title='Infocalypse Now - and how to Survive It?', @@ -780,7 +828,7 @@ herfbombs, solarstorms and intelligence agencies on steroids The Beast is unleashed, can it be stopped, or is it anyone for him self? ''', event_type=keynote, - camp=camp + track=track ) ev23 = Event.objects.create( title='Liquid Democracy (Introduction and Debate)', @@ -790,7 +838,7 @@ A lot has happened ever since the German pirates developed the first visions abo Monday will primarily be focused around The Alternatives experiment with Liquid Democracy and a constructive debate about how liquid democracy can improve The Alternative. Rolf Bjerre leads the process. ''', event_type=talk, - camp=camp + track=track ) ev24 = Event.objects.create( title='Badge Workshop', @@ -798,7 +846,7 @@ Monday will primarily be focused around The Alternatives experiment with Liquid In this workshop you can learn how to solder and get help assembling your badge. We will have soldering irons and other tools to help things along. You can also discuss your ideas for badge hacks and modifications with the other participants and the host, Thomas Flummer. ''', event_type=workshop, - camp=camp + track=track ) ev25 = Event.objects.create( title='Checking a Distributed Hash Table for Correctness', @@ -824,7 +872,7 @@ to give people an overview of how to attack larger code bases with (semi-) formal methods. ''', event_type=talk, - camp=camp + track=track ) ev26 = Event.objects.create( title='GraphQL - A Data Language', @@ -853,7 +901,7 @@ of the language. The running example is a GraphQL compiler written for Erlang. ''', event_type=talk, - camp=camp + track=track ) ev27 = Event.objects.create( title='Visualisation of Public Datasets', @@ -865,19 +913,19 @@ I will present some portals where it is possible to get public datasets. Afterwa Towards the end we will open up to debate about how to use these resources or if there are other solutions. ''', event_type=workshop, - camp=camp + track=track ) ev28 = Event.objects.create( title='Local delicacies', abstract='Come taste delicacies from bornholm', event_type=facility, - camp=camp + track=track ) ev29 = Event.objects.create( title='Local delicacies from the world', abstract='An attempt to create an event where we all prepare local delicacies for each other', event_type=facility, - camp=camp + track=track ) self.output("Creating speakers for {}...".format(year)) From 03b536ff26a4c0eb87816d7e7d47af0a1579f157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Sun, 20 May 2018 19:32:51 +0200 Subject: [PATCH 02/18] Fix channels consumer for program for the new content flow. --- src/program/consumers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/program/consumers.py b/src/program/consumers.py index a8db84ef..c325a0df 100644 --- a/src/program/consumers.py +++ b/src/program/consumers.py @@ -34,11 +34,11 @@ class ScheduleConsumer(JsonWebsocketConsumer): camp.get_days('camp') )) - events_query_set = Event.objects.filter(camp=camp) + events_query_set = Event.objects.filter(track__camp=camp) events = list([x.serialize() for x in events_query_set]) event_instances_query_set = EventInstance.objects.filter( - event__camp=camp + event__track__camp=camp ) event_instances = list([ x.serialize(user=user) From b172d678faa59a2694b5ba8c898d48c7396d6495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Sun, 20 May 2018 20:08:25 +0200 Subject: [PATCH 03/18] Add filter for tracks to the schedule --- schedule/src/Decoders.elm | 9 ++ schedule/src/Main.elm | 4 +- schedule/src/Models.elm | 7 ++ schedule/src/Update.elm | 13 +++ schedule/src/Views/FilterView.elm | 14 +++ src/program/consumers.py | 10 ++ src/program/models.py | 7 ++ src/program/static/js/elm_based_schedule.js | 123 ++++++++++++++------ 8 files changed, 151 insertions(+), 36 deletions(-) diff --git a/schedule/src/Decoders.elm b/schedule/src/Decoders.elm index b574794c..b0f75be7 100644 --- a/schedule/src/Decoders.elm +++ b/schedule/src/Decoders.elm @@ -82,6 +82,7 @@ eventInstanceDecoder = |> required "url" string |> required "event_slug" string |> required "event_type" string + |> required "event_track" string |> required "bg-color" string |> required "fg-color" string |> required "from" dateDecoder @@ -111,6 +112,13 @@ eventTypeDecoder = |> required "light_text" bool +eventTrackDecoder : Decoder FilterType +eventTrackDecoder = + decode TrackFilter + |> required "name" string + |> required "slug" string + + initDataDecoder : Decoder (Flags -> Filter -> Location -> Route -> Bool -> Model) initDataDecoder = decode Model @@ -119,4 +127,5 @@ initDataDecoder = |> required "event_instances" (list eventInstanceDecoder) |> required "event_locations" (list eventLocationDecoder) |> required "event_types" (list eventTypeDecoder) + |> required "event_tracks" (list eventTrackDecoder) |> required "speakers" (list speakerDecoder) diff --git a/schedule/src/Main.elm b/schedule/src/Main.elm index 7b03faeb..b165e2f0 100644 --- a/schedule/src/Main.elm +++ b/schedule/src/Main.elm @@ -34,10 +34,10 @@ init flags location = parseLocation location emptyFilter = - Filter [] [] [] + Filter [] [] [] [] model = - Model [] [] [] [] [] [] flags emptyFilter location currentRoute False + Model [] [] [] [] [] [] [] flags emptyFilter location currentRoute False in model ! [ sendInitMessage flags.camp_slug flags.websocket_server ] diff --git a/schedule/src/Models.elm b/schedule/src/Models.elm index 9f60f394..b9f37ed3 100644 --- a/schedule/src/Models.elm +++ b/schedule/src/Models.elm @@ -49,6 +49,7 @@ type alias Model = , eventInstances : List EventInstance , eventLocations : List FilterType , eventTypes : List FilterType + , eventTracks : List FilterType , speakers : List Speaker , flags : Flags , filter : Filter @@ -81,6 +82,7 @@ type alias EventInstance = , url : String , eventSlug : EventSlug , eventType : String + , eventTrack : String , backgroundColor : String , forgroundColor : String , from : Date @@ -142,11 +144,13 @@ type FilterType = TypeFilter FilterName FilterSlug TypeColor TypeLightText | LocationFilter FilterName FilterSlug LocationIcon | VideoFilter FilterName FilterSlug + | TrackFilter FilterName FilterSlug type alias Filter = { eventTypes : List FilterType , eventLocations : List FilterType + , eventTracks : List FilterType , videoRecording : List FilterType } @@ -162,6 +166,9 @@ unpackFilterType filter = VideoFilter name slug -> ( name, slug ) + TrackFilter name slug -> + ( name, slug ) + getSlugFromFilterType filter = let diff --git a/schedule/src/Update.elm b/schedule/src/Update.elm index 8d2ad964..720cea93 100644 --- a/schedule/src/Update.elm +++ b/schedule/src/Update.elm @@ -96,6 +96,19 @@ update msg model = videoRecording :: model.filter.videoRecording } + TrackFilter name slug -> + let + eventTrack = + TrackFilter name slug + in + { currentFilter + | eventTracks = + if List.member eventTrack model.filter.eventTracks then + List.filter (\x -> x /= eventTrack) model.filter.videoRecording + else + eventTrack :: model.filter.eventTracks + } + query = filterToQuery newFilter diff --git a/schedule/src/Views/FilterView.elm b/schedule/src/Views/FilterView.elm index 8a641868..6cfd6093 100644 --- a/schedule/src/Views/FilterView.elm +++ b/schedule/src/Views/FilterView.elm @@ -37,6 +37,9 @@ applyFilters day model = locations = slugs model.eventLocations model.filter.eventLocations + tracks = + slugs model.eventTracks model.filter.eventTracks + videoFilters = slugs videoRecordingFilters model.filter.videoRecording @@ -47,6 +50,7 @@ applyFilters day model = && (Date.Extra.equalBy Date.Extra.Day eventInstance.from day.date) && List.member eventInstance.location locations && List.member eventInstance.eventType types + && List.member eventInstance.eventTrack tracks && List.member eventInstance.videoState videoFilters ) model.eventInstances @@ -77,6 +81,12 @@ filterSidebar model = model.filter.eventLocations model.eventInstances .location + , filterView + "Track" + model.eventTracks + model.filter.eventTracks + model.eventInstances + .eventTrack , filterView "Video" videoRecordingFilters @@ -309,11 +319,15 @@ parseFilterFromQuery query model = locations = getFilter "location" model.eventLocations query + tracks = + getFilter "tracks" model.eventTracks query + videoFilters = getFilter "video" videoRecordingFilters query in { eventTypes = types , eventLocations = locations + , eventTracks = tracks , videoRecording = videoFilters } diff --git a/src/program/consumers.py b/src/program/consumers.py index c325a0df..c4bdeaaa 100644 --- a/src/program/consumers.py +++ b/src/program/consumers.py @@ -7,6 +7,7 @@ from .models import ( Favorite, EventLocation, EventType, + EventTrack, Speaker ) @@ -59,6 +60,14 @@ class ScheduleConsumer(JsonWebsocketConsumer): for x in event_types_query_set ]) + event_tracks_query_set = EventTrack.objects.filter( + camp=camp + ) + event_tracks = list([ + x.serialize() + for x in event_tracks_query_set + ]) + speakers_query_set = Speaker.objects.filter(camp=camp) speakers = list([x.serialize() for x in speakers_query_set]) @@ -68,6 +77,7 @@ class ScheduleConsumer(JsonWebsocketConsumer): "event_instances": event_instances, "event_locations": event_locations, "event_types": event_types, + "event_tracks": event_tracks, "speakers": speakers, "days": days, } diff --git a/src/program/models.py b/src/program/models.py index 5f4bd6ed..fd4a8164 100644 --- a/src/program/models.py +++ b/src/program/models.py @@ -258,6 +258,12 @@ class EventTrack(CampRelatedModel): class Meta: unique_together = (('camp', 'slug'), ('camp', 'name')) + def serialize(self): + return { + "name": self.name, + "slug": self.slug, + } + class EventLocation(CampRelatedModel): """ The places where stuff happens """ @@ -533,6 +539,7 @@ class EventInstance(CampRelatedModel): 'bg-color': self.event.event_type.color, 'fg-color': '#fff' if self.event.event_type.light_text else '#000', 'event_type': self.event.event_type.slug, + 'event_track': self.event.track.slug, 'location': self.location.slug, 'location_icon': self.location.icon, 'timeslots': self.timeslots, diff --git a/src/program/static/js/elm_based_schedule.js b/src/program/static/js/elm_based_schedule.js index 5e27d676..7243619b 100644 --- a/src/program/static/js/elm_based_schedule.js +++ b/src/program/static/js/elm_based_schedule.js @@ -13879,6 +13879,8 @@ var _user$project$Models$unpackFilterType = function (filter) { return {ctor: '_Tuple2', _0: _p0._0, _1: _p0._1}; case 'LocationFilter': return {ctor: '_Tuple2', _0: _p0._0, _1: _p0._1}; + case 'VideoFilter': + return {ctor: '_Tuple2', _0: _p0._0, _1: _p0._1}; default: return {ctor: '_Tuple2', _0: _p0._0, _1: _p0._1}; } @@ -13905,7 +13907,9 @@ var _user$project$Models$Model = function (a) { return function (i) { return function (j) { return function (k) { - return {days: a, events: b, eventInstances: c, eventLocations: d, eventTypes: e, speakers: f, flags: g, filter: h, location: i, route: j, dataLoaded: k}; + return function (l) { + return {days: a, events: b, eventInstances: c, eventLocations: d, eventTypes: e, eventTracks: f, speakers: g, flags: h, filter: i, location: j, route: k, dataLoaded: l}; + }; }; }; }; @@ -13941,7 +13945,9 @@ var _user$project$Models$EventInstance = function (a) { return function (n) { return function (o) { return function (p) { - return {title: a, slug: b, id: c, url: d, eventSlug: e, eventType: f, backgroundColor: g, forgroundColor: h, from: i, to: j, timeslots: k, location: l, locationIcon: m, videoState: n, videoUrl: o, isFavorited: p}; + return function (q) { + return {title: a, slug: b, id: c, url: d, eventSlug: e, eventType: f, eventTrack: g, backgroundColor: h, forgroundColor: i, from: j, to: k, timeslots: l, location: m, locationIcon: n, videoState: o, videoUrl: p, isFavorited: q}; + }; }; }; }; @@ -13966,9 +13972,9 @@ var _user$project$Models$Flags = F5( function (a, b, c, d, e) { return {schedule_timeslot_length_minutes: a, schedule_midnight_offset_hours: b, ics_button_href: c, camp_slug: d, websocket_server: e}; }); -var _user$project$Models$Filter = F3( - function (a, b, c) { - return {eventTypes: a, eventLocations: b, videoRecording: c}; +var _user$project$Models$Filter = F4( + function (a, b, c, d) { + return {eventTypes: a, eventLocations: b, eventTracks: c, videoRecording: d}; }); var _user$project$Models$NotFoundRoute = {ctor: 'NotFoundRoute'}; var _user$project$Models$SpeakerRoute = function (a) { @@ -13984,6 +13990,10 @@ var _user$project$Models$OverviewFilteredRoute = function (a) { return {ctor: 'OverviewFilteredRoute', _0: a}; }; var _user$project$Models$OverviewRoute = {ctor: 'OverviewRoute'}; +var _user$project$Models$TrackFilter = F2( + function (a, b) { + return {ctor: 'TrackFilter', _0: a, _1: b}; + }); var _user$project$Models$VideoFilter = F2( function (a, b) { return {ctor: 'VideoFilter', _0: a, _1: b}; @@ -13997,6 +14007,15 @@ var _user$project$Models$TypeFilter = F4( return {ctor: 'TypeFilter', _0: a, _1: b, _2: c, _3: d}; }); +var _user$project$Decoders$eventTrackDecoder = A3( + _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, + 'slug', + _elm_lang$core$Json_Decode$string, + A3( + _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, + 'name', + _elm_lang$core$Json_Decode$string, + _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$decode(_user$project$Models$TrackFilter))); var _user$project$Decoders$eventTypeDecoder = A3( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, 'light_text', @@ -14080,29 +14099,33 @@ var _user$project$Decoders$eventInstanceDecoder = A4( _elm_lang$core$Json_Decode$string, A3( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, - 'event_type', + 'event_track', _elm_lang$core$Json_Decode$string, A3( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, - 'event_slug', + 'event_type', _elm_lang$core$Json_Decode$string, A3( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, - 'url', + 'event_slug', _elm_lang$core$Json_Decode$string, A3( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, - 'id', - _elm_lang$core$Json_Decode$int, + 'url', + _elm_lang$core$Json_Decode$string, A3( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, - 'slug', - _elm_lang$core$Json_Decode$string, + 'id', + _elm_lang$core$Json_Decode$int, A3( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, - 'title', + 'slug', _elm_lang$core$Json_Decode$string, - _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$decode(_user$project$Models$EventInstance))))))))))))))))); + A3( + _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, + 'title', + _elm_lang$core$Json_Decode$string, + _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$decode(_user$project$Models$EventInstance)))))))))))))))))); var _user$project$Decoders$eventDecoder = A3( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, 'event_type', @@ -14175,25 +14198,29 @@ var _user$project$Decoders$initDataDecoder = A3( _elm_lang$core$Json_Decode$list(_user$project$Decoders$speakerDecoder), A3( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, - 'event_types', - _elm_lang$core$Json_Decode$list(_user$project$Decoders$eventTypeDecoder), + 'event_tracks', + _elm_lang$core$Json_Decode$list(_user$project$Decoders$eventTrackDecoder), A3( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, - 'event_locations', - _elm_lang$core$Json_Decode$list(_user$project$Decoders$eventLocationDecoder), + 'event_types', + _elm_lang$core$Json_Decode$list(_user$project$Decoders$eventTypeDecoder), A3( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, - 'event_instances', - _elm_lang$core$Json_Decode$list(_user$project$Decoders$eventInstanceDecoder), + 'event_locations', + _elm_lang$core$Json_Decode$list(_user$project$Decoders$eventLocationDecoder), A3( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, - 'events', - _elm_lang$core$Json_Decode$list(_user$project$Decoders$eventDecoder), + 'event_instances', + _elm_lang$core$Json_Decode$list(_user$project$Decoders$eventInstanceDecoder), A3( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, - 'days', - _elm_lang$core$Json_Decode$list(_user$project$Decoders$dayDecoder), - _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$decode(_user$project$Models$Model))))))); + 'events', + _elm_lang$core$Json_Decode$list(_user$project$Decoders$eventDecoder), + A3( + _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, + 'days', + _elm_lang$core$Json_Decode$list(_user$project$Decoders$dayDecoder), + _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$decode(_user$project$Models$Model)))))))); var _user$project$Decoders$WebSocketAction = function (a) { return {action: a}; }; @@ -14709,9 +14736,10 @@ var _user$project$Views_FilterView$videoRecordingFilters = { var _user$project$Views_FilterView$parseFilterFromQuery = F2( function (query, model) { var videoFilters = A3(_user$project$Views_FilterView$getFilter, 'video', _user$project$Views_FilterView$videoRecordingFilters, query); + var tracks = A3(_user$project$Views_FilterView$getFilter, 'tracks', model.eventTracks, query); var locations = A3(_user$project$Views_FilterView$getFilter, 'location', model.eventLocations, query); var types = A3(_user$project$Views_FilterView$getFilter, 'type', model.eventTypes, query); - return {eventTypes: types, eventLocations: locations, videoRecording: videoFilters}; + return {eventTypes: types, eventLocations: locations, eventTracks: tracks, videoRecording: videoFilters}; }); var _user$project$Views_FilterView$icsButton = function (model) { var filterString = function () { @@ -14835,14 +14863,26 @@ var _user$project$Views_FilterView$filterSidebar = function (model) { ctor: '::', _0: A5( _user$project$Views_FilterView$filterView, - 'Video', - _user$project$Views_FilterView$videoRecordingFilters, - model.filter.videoRecording, + 'Track', + model.eventTracks, + model.filter.eventTracks, model.eventInstances, function (_) { - return _.videoState; + return _.eventTrack; }), - _1: {ctor: '[]'} + _1: { + ctor: '::', + _0: A5( + _user$project$Views_FilterView$filterView, + 'Video', + _user$project$Views_FilterView$videoRecordingFilters, + model.filter.videoRecording, + model.eventInstances, + function (_) { + return _.videoState; + }), + _1: {ctor: '[]'} + } } } }), @@ -14865,11 +14905,12 @@ var _user$project$Views_FilterView$applyFilters = F2( }); var types = A2(slugs, model.eventTypes, model.filter.eventTypes); var locations = A2(slugs, model.eventLocations, model.filter.eventLocations); + var tracks = A2(slugs, model.eventTracks, model.filter.eventTracks); var videoFilters = A2(slugs, _user$project$Views_FilterView$videoRecordingFilters, model.filter.videoRecording); var filteredEventInstances = A2( _elm_lang$core$List$filter, function (eventInstance) { - return A3(_justinmimbs$elm_date_extra$Date_Extra$equalBy, _justinmimbs$elm_date_extra$Date_Extra$Month, eventInstance.from, day.date) && (A3(_justinmimbs$elm_date_extra$Date_Extra$equalBy, _justinmimbs$elm_date_extra$Date_Extra$Day, eventInstance.from, day.date) && (A2(_elm_lang$core$List$member, eventInstance.location, locations) && (A2(_elm_lang$core$List$member, eventInstance.eventType, types) && A2(_elm_lang$core$List$member, eventInstance.videoState, videoFilters)))); + return A3(_justinmimbs$elm_date_extra$Date_Extra$equalBy, _justinmimbs$elm_date_extra$Date_Extra$Month, eventInstance.from, day.date) && (A3(_justinmimbs$elm_date_extra$Date_Extra$equalBy, _justinmimbs$elm_date_extra$Date_Extra$Day, eventInstance.from, day.date) && (A2(_elm_lang$core$List$member, eventInstance.location, locations) && (A2(_elm_lang$core$List$member, eventInstance.eventType, types) && (A2(_elm_lang$core$List$member, eventInstance.eventTrack, tracks) && A2(_elm_lang$core$List$member, eventInstance.videoState, videoFilters))))); }, model.eventInstances); return filteredEventInstances; @@ -14939,7 +14980,7 @@ var _user$project$Update$update = F2( }, model.filter.eventLocations) : {ctor: '::', _0: eventLocation, _1: model.filter.eventLocations} }); - default: + case 'VideoFilter': var videoRecording = A2(_user$project$Models$VideoFilter, _p6._0, _p6._1); return _elm_lang$core$Native_Utils.update( currentFilter, @@ -14951,6 +14992,18 @@ var _user$project$Update$update = F2( }, model.filter.videoRecording) : {ctor: '::', _0: videoRecording, _1: model.filter.videoRecording} }); + default: + var eventTrack = A2(_user$project$Models$TrackFilter, _p6._0, _p6._1); + return _elm_lang$core$Native_Utils.update( + currentFilter, + { + eventTracks: A2(_elm_lang$core$List$member, eventTrack, model.filter.eventTracks) ? A2( + _elm_lang$core$List$filter, + function (x) { + return !_elm_lang$core$Native_Utils.eq(x, eventTrack); + }, + model.filter.videoRecording) : {ctor: '::', _0: eventTrack, _1: model.filter.eventTracks} + }); } }(); var query = _user$project$Views_FilterView$filterToQuery(newFilter); @@ -16690,10 +16743,11 @@ var _user$project$Main$subscriptions = function (model) { }; var _user$project$Main$init = F2( function (flags, location) { - var emptyFilter = A3( + var emptyFilter = A4( _user$project$Models$Filter, {ctor: '[]'}, {ctor: '[]'}, + {ctor: '[]'}, {ctor: '[]'}); var currentRoute = _user$project$Routing$parseLocation(location); var model = _user$project$Models$Model( @@ -16702,6 +16756,7 @@ var _user$project$Main$init = F2( {ctor: '[]'})( {ctor: '[]'})( {ctor: '[]'})( + {ctor: '[]'})( {ctor: '[]'})(flags)(emptyFilter)(location)(currentRoute)(false); return A2( _elm_lang$core$Platform_Cmd_ops['!'], From c8ab0230cd068162b7b47536f7d33e461063501f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Sun, 20 May 2018 20:29:56 +0200 Subject: [PATCH 04/18] Add detail view for speaker and event proposals. --- src/program/templates/proposal_list.html | 6 ++++++ src/program/urls.py | 10 ++++++++++ src/program/views.py | 10 ++++++++++ 3 files changed, 26 insertions(+) diff --git a/src/program/templates/proposal_list.html b/src/program/templates/proposal_list.html index bd21a8b0..42a31fac 100644 --- a/src/program/templates/proposal_list.html +++ b/src/program/templates/proposal_list.html @@ -41,6 +41,9 @@ Proposals | {{ block.super }} {{ speakerproposal.proposal_status }} + + Detail {% if not camp.read_only %} Modify Add Event @@ -81,6 +84,9 @@ Proposals | {{ block.super }} {{ eventproposal.track.name }} {{ eventproposal.proposal_status }} + + Detail {% if not camp.read_only %} Modify {% if eventproposal.get_available_speakerproposals.exists %} diff --git a/src/program/urls.py b/src/program/urls.py index 4bc6c57b..8aee430a 100644 --- a/src/program/urls.py +++ b/src/program/urls.py @@ -43,6 +43,11 @@ urlpatterns = [ ), url( r'^people/', include([ + url( + r'^(?P[a-f0-9-]+)/$', + SpeakerProposalDetailView.as_view(), + name='speakerproposal_detail' + ), url( r'^(?P[a-f0-9-]+)/update/$', SpeakerProposalUpdateView.as_view(), @@ -67,6 +72,11 @@ urlpatterns = [ ), url( r'^events/', include([ + url( + r'^(?P[a-f0-9-]+)/$', + EventProposalDetailView.as_view(), + name='eventproposal_detail' + ), url( r'^(?P[a-f0-9-]+)/edit/$', EventProposalUpdateView.as_view(), diff --git a/src/program/views.py b/src/program/views.py index e26be0cb..f05730f3 100644 --- a/src/program/views.py +++ b/src/program/views.py @@ -202,6 +202,12 @@ class SpeakerProposalDeleteView(LoginRequiredMixin, CampViewMixin, EnsureWritabl return reverse('program:proposal_list', kwargs={'camp_slug': self.camp.slug}) + +class SpeakerProposalDetailView(LoginRequiredMixin, CampViewMixin, EnsureWritableCampMixin, EnsureUserOwnsProposalMixin, EnsureCFPOpenMixin, DetailView): + model = models.SpeakerProposal + template_name = 'speakerproposal_detail.html' + + ################################################################################################### # eventproposal views @@ -370,6 +376,10 @@ class EventProposalDeleteView(LoginRequiredMixin, CampViewMixin, EnsureWritableC return reverse('program:proposal_list', kwargs={'camp_slug': self.camp.slug}) +class EventProposalDetailView(LoginRequiredMixin, CampViewMixin, EnsureWritableCampMixin, EnsureUserOwnsProposalMixin, EnsureCFPOpenMixin, DetailView): + model = models.EventProposal + template_name = 'eventproposal_detail.html' + ################################################################################################### # combined proposal views From 733fdbf4bae25822136eee32a2ad7f2f64919c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Sun, 20 May 2018 20:53:28 +0200 Subject: [PATCH 05/18] Add lists of events/speakers til speaker/event detail template. --- .../templates/eventproposal_detail.html | 11 +++ .../includes/event_proposal_table.html | 37 +++++++++ .../includes/speaker_proposal_table.html | 39 ++++++++++ src/program/templates/proposal_list.html | 78 +------------------ .../templates/speakerproposal_detail.html | 24 +++--- 5 files changed, 100 insertions(+), 89 deletions(-) create mode 100644 src/program/templates/includes/event_proposal_table.html create mode 100644 src/program/templates/includes/speaker_proposal_table.html diff --git a/src/program/templates/eventproposal_detail.html b/src/program/templates/eventproposal_detail.html index f2c7b01e..0f287656 100644 --- a/src/program/templates/eventproposal_detail.html +++ b/src/program/templates/eventproposal_detail.html @@ -17,6 +17,17 @@ +
+
Events
+
+ {% if eventproposal.speakers.exists %} + {% include 'includes/speaker_proposal_table.html' with speakerproposals=eventproposal.speakers.all %} + {% else %} + Nothing found. + {% endif %} +
+
+

Back to List

diff --git a/src/program/templates/includes/event_proposal_table.html b/src/program/templates/includes/event_proposal_table.html new file mode 100644 index 00000000..6868e962 --- /dev/null +++ b/src/program/templates/includes/event_proposal_table.html @@ -0,0 +1,37 @@ + + + + + + + + + + + + + {% for eventproposal in eventproposals %} + + + + + + + + + {% endfor %} + +
TitleTypePeopleTrackStatusAvailable Actions
{{ eventproposal.title }} {{ eventproposal.event_type }}{% for person in eventproposal.speakers.all %} {% endfor %}{{ eventproposal.track.name }}{{ eventproposal.proposal_status }} + + Detail + {% if not camp.read_only %} + Modify + {% if eventproposal.get_available_speakerproposals.exists %} + Add {{ eventproposal.event_type.host_title }} + {% else %} + Add {{ eventproposal.event_type.host_title }} + {% endif %} + Delete + {% endif %} +
diff --git a/src/program/templates/includes/speaker_proposal_table.html b/src/program/templates/includes/speaker_proposal_table.html new file mode 100644 index 00000000..a9254133 --- /dev/null +++ b/src/program/templates/includes/speaker_proposal_table.html @@ -0,0 +1,39 @@ + + + + + + + + + + + {% for speakerproposal in speakerproposals %} + + + + + + + {% endfor %} + +
NameEventsStatusAvailable Actions
{{ speakerproposal.name }} + {% if speakerproposal.eventproposals.all %} + {% for ep in speakerproposal.eventproposals.all %} + + {% endfor %} + {% else %} + N/A + {% endif %} + {{ speakerproposal.proposal_status }} + + Detail + {% if not camp.read_only %} + Modify + Add Event + {% if not speakerproposal.eventproposals.all %} + Delete + {% endif %} + {% endif %} +
diff --git a/src/program/templates/proposal_list.html b/src/program/templates/proposal_list.html index 42a31fac..a1bc0ec2 100644 --- a/src/program/templates/proposal_list.html +++ b/src/program/templates/proposal_list.html @@ -17,45 +17,7 @@ Proposals | {{ block.super }}

People

{% if speakerproposal_list %} - - - - - - - - - - - {% for speakerproposal in speakerproposal_list %} - - - - - - - {% endfor %} - -
NameEventsStatusAvailable Actions
{{ speakerproposal.name }} - {% if speakerproposal.eventproposals.all %} - {% for ep in speakerproposal.eventproposals.all %} - - {% endfor %} - {% else %} - N/A - {% endif %} - {{ speakerproposal.proposal_status }} - - Detail - {% if not camp.read_only %} - Modify - Add Event - {% if not speakerproposal.eventproposals.all %} - Delete - {% endif %} - {% endif %} -
+ {% include 'includes/speaker_proposal_table.html' with speakerproposals=speakerproposal_list %} {% else %} Nothing found. {% endif %} @@ -64,43 +26,7 @@ Proposals | {{ block.super }}

Events

{% if eventproposal_list %} - - - - - - - - - - - - - {% for eventproposal in eventproposal_list %} - - - - - - - - - {% endfor %} - -
TitleTypePeopleTrackStatusAvailable Actions
{{ eventproposal.title }} {{ eventproposal.event_type }}{% for person in eventproposal.speakers.all %} {% endfor %}{{ eventproposal.track.name }}{{ eventproposal.proposal_status }} - - Detail - {% if not camp.read_only %} - Modify - {% if eventproposal.get_available_speakerproposals.exists %} - Add {{ eventproposal.event_type.host_title }} - {% else %} - Add {{ eventproposal.event_type.host_title }} - {% endif %} - Delete - {% endif %} -
+ {% include 'includes/event_proposal_table.html' with eventproposals=eventproposal_list %} {% else %} Nothing found. {% endif %} diff --git a/src/program/templates/speakerproposal_detail.html b/src/program/templates/speakerproposal_detail.html index 7d6de89c..f7b1166f 100644 --- a/src/program/templates/speakerproposal_detail.html +++ b/src/program/templates/speakerproposal_detail.html @@ -13,20 +13,18 @@
{{ speakerproposal.name }}
- {% if speakerproposal.picture_large and speakerproposal.picture_small %} -
-
{{ speakerproposal.biography|commonmark }} -
-
- - {{ camp.title }} speaker picture of {{ speakerproposal.name }} - -
-
- {% else %} - {{ speakerproposal.biography|commonmark }} - {% endif %} +
+
+ +
+
Events
+
+ {% if speakerproposal.eventproposals.exists %} + {% include 'includes/event_proposal_table.html' with eventproposals=speakerproposal.eventproposals.all %} + {% else %} + Nothing found. + {% endif %}
From 5dc3e17d66589d113dc00d678e0dc2cc789f6407 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Sun, 20 May 2018 21:11:53 +0200 Subject: [PATCH 06/18] if one or more speakerproposals exist show a list so the user can pick an existing or choose to add a new; use the multimodelform stuff only when the user wants to add a new speakerproposal --- .../combined_proposal_select_person.html | 33 ++++++++ .../includes/event_proposal_type_select.html | 2 +- src/program/urls.py | 5 ++ src/program/views.py | 82 +++++++++++++------ 4 files changed, 97 insertions(+), 25 deletions(-) create mode 100644 src/program/templates/combined_proposal_select_person.html diff --git a/src/program/templates/combined_proposal_select_person.html b/src/program/templates/combined_proposal_select_person.html new file mode 100644 index 00000000..a57fd5dd --- /dev/null +++ b/src/program/templates/combined_proposal_select_person.html @@ -0,0 +1,33 @@ +{% extends 'program_base.html' %} + +{% block title %} +Use Existing {{ eventtype.host_title }} or Add New? | {{ block.super }} +{% endblock %} + +{% block program_content %} + +

Use Existing {{ eventtype.host_title }}?

+ +

Pick a {{ eventtype.host_title }} from the list below, or press the button at the bottom to add a new {{ eventtype.host_title }} for this {{ eventtype.name }}.

+ +
+
+

Use an Existing {{ eventtype.host_title }}

+
+
+
+ {% for speakerproposal in speakerproposal_list %} + +

+ Use {{ speakerproposal.name }} as {{ eventtype.host_title }} +

+
+ {% endfor %} +
+
+
+ + Add New {{ eventtype.host_title }} + Cancel +{% endblock %} + diff --git a/src/program/templates/includes/event_proposal_type_select.html b/src/program/templates/includes/event_proposal_type_select.html index c335be58..0a5d3d9d 100644 --- a/src/program/templates/includes/event_proposal_type_select.html +++ b/src/program/templates/includes/event_proposal_type_select.html @@ -14,7 +14,7 @@ {% if speaker %} {% else %} - + {% endif %}

diff --git a/src/program/urls.py b/src/program/urls.py index 8aee430a..0861f0d6 100644 --- a/src/program/urls.py +++ b/src/program/urls.py @@ -39,6 +39,11 @@ urlpatterns = [ CombinedProposalSubmitView.as_view(), name='proposal_combined_submit', ), + url( + r'^(?P[-_\w+]+)/select_person/$', + CombinedProposalPersonSelectView.as_view(), + name='proposal_combined_person_select', + ), ]), ), url( diff --git a/src/program/views.py b/src/program/views.py index f05730f3..52a8ee39 100644 --- a/src/program/views.py +++ b/src/program/views.py @@ -269,9 +269,8 @@ class EventProposalAddPersonView(LoginRequiredMixin, CampViewMixin, EnsureWritab def dispatch(self, request, *args, **kwargs): """ Get the speakerproposal object """ - response = super().dispatch(request, *args, **kwargs) self.speakerproposal = get_object_or_404(models.SpeakerProposal, pk=kwargs['speaker_uuid'], user=request.user) - return response + return super().dispatch(request, *args, **kwargs) def get_context_data(self, *args, **kwargs): """ Make speakerproposal object available in template """ @@ -396,10 +395,38 @@ class CombinedProposalTypeSelectView(LoginRequiredMixin, CampViewMixin, ListView return super().get_queryset().filter(public=True) +class CombinedProposalPersonSelectView(LoginRequiredMixin, CampViewMixin, ListView): + """ + A view which allows the user to 1) choose between existing SpeakerProposals or + 2) pressing a button to create a new SpeakerProposal. + Redirect straight to 2) if no existing SpeakerProposals exist. + """ + model = models.SpeakerProposal + template_name = 'combined_proposal_select_person.html' + + def dispatch(self, request, *args, **kwargs): + """ + Check that we have a valid EventType + """ + # get EventType from url kwargs + self.eventtype = get_object_or_404(models.EventType, slug=self.kwargs['event_type_slug']) + + return super().dispatch(request, *args, **kwargs) + + def get_context_data(self, **kwargs): + """ + Add EventType to template context + """ + context = super().get_context_data(**kwargs) + context['eventtype'] = self.eventtype + return context + + class CombinedProposalSubmitView(LoginRequiredMixin, CampViewMixin, CreateView): """ This view is used by users to submit CFP proposals. It allows the user to submit an EventProposal and a SpeakerProposal together. + It can also be used with a preselected SpeakerProposal uuid in url kwargs """ template_name = 'combined_proposal_submit.html' @@ -407,16 +434,10 @@ class CombinedProposalSubmitView(LoginRequiredMixin, CampViewMixin, CreateView): """ Check that we have a valid EventType """ - try: - self.eventtype = models.EventType.objects.get( - slug=self.kwargs['event_type_slug'] - ) - except models.EventType.DoesNotExist: - raise Http404 + # get EventType from url kwargs + self.eventtype = get_object_or_404(models.EventType, slug=self.kwargs['event_type_slug']) - return super().dispatch( - request, *args, **kwargs - ) + return super().dispatch(request, *args, **kwargs) def get_context_data(self, **kwargs): """ @@ -428,30 +449,43 @@ class CombinedProposalSubmitView(LoginRequiredMixin, CampViewMixin, CreateView): def form_valid(self, form): """ - We save each object here before redirecting + Save the object(s) here before redirecting """ - # first save the SpeakerProposal - speakerproposal = form['speakerproposal'].save(commit=False) - speakerproposal.camp = self.camp - speakerproposal.user = self.request.user - speakerproposal.save() + if hasattr(self, 'speakerproposal'): + eventproposal = form.save(commit=False) + eventproposal.user = self.request.user + eventproposal.event_type = self.eventtype + eventproposal.save() + eventproposal.speakers.add(self.speakerproposal) + else: + # first save the SpeakerProposal + speakerproposal = form['speakerproposal'].save(commit=False) + speakerproposal.camp = self.camp + speakerproposal.user = self.request.user + speakerproposal.save() - # then save the eventproposal - eventproposal = form['eventproposal'].save(commit=False) - eventproposal.user = self.request.user - eventproposal.event_type = self.eventtype - eventproposal.save() + # then save the eventproposal + eventproposal = form['eventproposal'].save(commit=False) + eventproposal.user = self.request.user + eventproposal.event_type = self.eventtype + eventproposal.save() - # add the speakerproposal to the eventproposal - eventproposal.speakers.add(speakerproposal) + # add the speakerproposal to the eventproposal + eventproposal.speakers.add(speakerproposal) # all good return redirect(reverse_lazy('program:proposal_list', kwargs={'camp_slug': self.camp.slug})) def get_form_class(self): """ + Unless we have an existing SpeakerProposal we must show two forms on the page. We use betterforms.MultiModelForm to combine two forms on the page """ + if hasattr(self, 'speakerproposal'): + # we already have a speakerproposal, just show an eventproposal form + return get_eventproposal_form_class(eventtype=self.eventtype) + + # get the two forms we need to build the MultiModelForm SpeakerProposalForm = get_speakerproposal_form_class(eventtype=self.eventtype) EventProposalForm = get_eventproposal_form_class(eventtype=self.eventtype) From 743cf25476968d7a21c92efa5570f4345c17d5be Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Sun, 20 May 2018 21:29:37 +0200 Subject: [PATCH 07/18] add abstract field for music acts --- src/program/forms.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/program/forms.py b/src/program/forms.py index 1cf6fe0a..8c74b883 100644 --- a/src/program/forms.py +++ b/src/program/forms.py @@ -176,6 +176,10 @@ class MusicEventProposalForm(BaseEventProposalForm): self.fields['title'].label = 'Title of music act' self.fields['title'].help_text = 'The title of this music act/concert/set.' + # fix label and help_text for the abstract field + self.fields['abstract'].label = 'Description' + self.fields['abstract'].help_text = 'The description of this music act' + # fix label and help_text for the submission_notes field self.fields['submission_notes'].label = 'Music Act Notes' self.fields['submission_notes'].help_text = 'Private notes regarding this music act. Only visible to yourself and the BornHack organisers.' @@ -183,9 +187,6 @@ class MusicEventProposalForm(BaseEventProposalForm): # no video recording for music acts del(self.fields['allow_video_recording']) - # no abstract for music acts - del(self.fields['abstract']) - # better placeholder text for duration field self.fields['duration'].widget.attrs['placeholder'] = 'Duration (minutes)' From 4720b34021d03dd71d70bc1a47d61163b7682879 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Sun, 20 May 2018 21:32:05 +0200 Subject: [PATCH 08/18] link to detail view rather than update view in the tables, shine up the detail views a bit --- src/program/templates/eventproposal_detail.html | 9 +++------ src/program/templates/includes/event_proposal_table.html | 2 +- .../templates/includes/speaker_proposal_table.html | 2 +- src/program/templates/speakerproposal_detail.html | 8 ++------ 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/program/templates/eventproposal_detail.html b/src/program/templates/eventproposal_detail.html index 0f287656..943165bf 100644 --- a/src/program/templates/eventproposal_detail.html +++ b/src/program/templates/eventproposal_detail.html @@ -3,18 +3,15 @@ {% block program_content %} -

{{ camp.title }} Event Proposal Details

- -
    -
  • Status: {{ eventproposal.proposal_status }}
  • -
  • ID: {{ eventproposal.uuid }}
  • -
+

{{ eventproposal.title }} Details

{{ eventproposal.title }}
+
diff --git a/src/program/templates/includes/event_proposal_table.html b/src/program/templates/includes/event_proposal_table.html index 6868e962..18696705 100644 --- a/src/program/templates/includes/event_proposal_table.html +++ b/src/program/templates/includes/event_proposal_table.html @@ -14,7 +14,7 @@ {{ eventproposal.title }} {{ eventproposal.event_type }} - {% for person in eventproposal.speakers.all %} {% endfor %} + {% for person in eventproposal.speakers.all %} {% endfor %} {{ eventproposal.track.name }} {{ eventproposal.proposal_status }} diff --git a/src/program/templates/includes/speaker_proposal_table.html b/src/program/templates/includes/speaker_proposal_table.html index a9254133..8f960ad1 100644 --- a/src/program/templates/includes/speaker_proposal_table.html +++ b/src/program/templates/includes/speaker_proposal_table.html @@ -14,7 +14,7 @@ {% if speakerproposal.eventproposals.all %} {% for ep in speakerproposal.eventproposals.all %} - + {% endfor %} {% else %} N/A diff --git a/src/program/templates/speakerproposal_detail.html b/src/program/templates/speakerproposal_detail.html index f7b1166f..3a44fdec 100644 --- a/src/program/templates/speakerproposal_detail.html +++ b/src/program/templates/speakerproposal_detail.html @@ -3,18 +3,14 @@ {% block program_content %} -

{{ camp.title }} Speaker Proposal Details

- -
    -
  • Status: {{ speakerproposal.proposal_status }}
  • -
  • ID: {{ speakerproposal.uuid }}
  • -
+

{{ speakerproposal.name }} Details

{{ speakerproposal.name }}
{{ speakerproposal.biography|commonmark }}
+
From 84c19d01c1a42a186261062e68adeca71cde18bd Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Sun, 20 May 2018 21:36:33 +0200 Subject: [PATCH 09/18] remove tooltip, add missing update button on speakerproposal detail page --- src/program/templates/includes/speaker_proposal_table.html | 2 +- src/program/templates/speakerproposal_detail.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/program/templates/includes/speaker_proposal_table.html b/src/program/templates/includes/speaker_proposal_table.html index 8f960ad1..d656b3eb 100644 --- a/src/program/templates/includes/speaker_proposal_table.html +++ b/src/program/templates/includes/speaker_proposal_table.html @@ -27,7 +27,7 @@ Detail {% if not camp.read_only %} Modify - Add Event + Add Event {% if not speakerproposal.eventproposals.all %} Delete {% endif %} diff --git a/src/program/templates/speakerproposal_detail.html b/src/program/templates/speakerproposal_detail.html index 3a44fdec..bf11bfeb 100644 --- a/src/program/templates/speakerproposal_detail.html +++ b/src/program/templates/speakerproposal_detail.html @@ -9,6 +9,7 @@
{{ speakerproposal.name }}
{{ speakerproposal.biography|commonmark }} + Modify
From 1fb4eb7e280a9782764048537b0ac01d52d7d6d2 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Sun, 20 May 2018 21:42:11 +0200 Subject: [PATCH 10/18] remove help box with status explanations, no room :( --- src/program/templates/proposal_list.html | 44 +++++++----------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/src/program/templates/proposal_list.html b/src/program/templates/proposal_list.html index a1bc0ec2..564c7d55 100644 --- a/src/program/templates/proposal_list.html +++ b/src/program/templates/proposal_list.html @@ -14,39 +14,21 @@ Proposals | {{ block.super }}

Existing Proposals

-
-

People

- {% if speakerproposal_list %} - {% include 'includes/speaker_proposal_table.html' with speakerproposals=speakerproposal_list %} - {% else %} - Nothing found. - {% endif %} +

People

+ {% if speakerproposal_list %} + {% include 'includes/speaker_proposal_table.html' with speakerproposals=speakerproposal_list %} + {% else %} + Nothing found. + {% endif %} -


+


-

Events

- {% if eventproposal_list %} - {% include 'includes/event_proposal_table.html' with eventproposals=eventproposal_list %} - {% else %} - Nothing found. - {% endif %} -
-
-
-
-

Status Help

-
-
-
-
pending
-
Submission is pending review from the Content Team.

-
approved
-
Submission was approved and will be part of this years camp.

-
rejected
-
Submission was not approved.
-
-
-
+

Events

+ {% if eventproposal_list %} + {% include 'includes/event_proposal_table.html' with eventproposals=eventproposal_list %} + {% else %} + Nothing found. + {% endif %}
{% endif %} From df783168c60a1a0ad1681827624c60596650a1cb Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Sun, 20 May 2018 21:54:36 +0200 Subject: [PATCH 11/18] filter speakerproposals by user, and redirect directly to combined submit view if no existing speakerproposals was found --- src/program/views.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/program/views.py b/src/program/views.py index 52a8ee39..8862f421 100644 --- a/src/program/views.py +++ b/src/program/views.py @@ -413,6 +413,10 @@ class CombinedProposalPersonSelectView(LoginRequiredMixin, CampViewMixin, ListVi return super().dispatch(request, *args, **kwargs) + def get_queryset(self, **kwargs): + # only show speaker proposals for the current user + return super().get_queryset().filter(user=self.request.user) + def get_context_data(self, **kwargs): """ Add EventType to template context @@ -421,6 +425,12 @@ class CombinedProposalPersonSelectView(LoginRequiredMixin, CampViewMixin, ListVi context['eventtype'] = self.eventtype return context + def get(self, request, *args, **kwargs): + """ If we don't have any existing SpeakerProposals just redirect directly to the combined submit view """ + if not self.get_queryset().exists(): + return redirect(reverse_lazy('program:proposal_combined_submit', kwargs={'camp_slug': self.camp.slug, 'event_type_slug': self.eventtype.slug})) + return super().get(request, *args, **kwargs) + class CombinedProposalSubmitView(LoginRequiredMixin, CampViewMixin, CreateView): """ From 18c33383b7b86b34432451308aa241d016c40d6c Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Wed, 23 May 2018 23:28:27 +0200 Subject: [PATCH 12/18] add url support for speakerproposals and eventproposals, including new models Url and UrlType. Also switch to Django 2.0 path() syntax in various urls.py files getting rid of a lot of ugly regex \o/ --- src/backoffice/urls.py | 12 +- src/bornhack/urls.py | 137 +++++++-------- src/news/urls.py | 8 +- src/profiles/urls.py | 6 +- src/program/admin.py | 12 +- .../migrations/0055_auto_20180521_2354.py | 48 ++++++ src/program/migrations/0056_add_urltypes.py | 58 +++++++ .../migrations/0057_auto_20180522_0659.py | 18 ++ .../migrations/0058_auto_20180523_0844.py | 22 +++ .../migrations/0059_auto_20180523_2241.py | 23 +++ src/program/mixins.py | 43 ++++- src/program/models.py | 130 +++++++++++++++ .../templates/eventproposal_detail.html | 14 +- .../includes/event_proposal_table.html | 3 + .../includes/eventproposalurl_table.html | 23 +++ .../includes/speaker_proposal_table.html | 10 +- .../includes/speakerproposalurl_table.html | 23 +++ .../templates/speakerproposal_detail.html | 14 +- src/program/templates/url_delete.html | 19 +++ src/program/templates/url_form.html | 21 +++ src/program/urls.py | 156 +++++++++++------- src/program/views.py | 40 ++++- src/shop/urls.py | 37 +++-- src/teams/urls.py | 62 +++---- src/tickets/urls.py | 14 +- src/villages/urls.py | 12 +- 26 files changed, 751 insertions(+), 214 deletions(-) create mode 100644 src/program/migrations/0055_auto_20180521_2354.py create mode 100644 src/program/migrations/0056_add_urltypes.py create mode 100644 src/program/migrations/0057_auto_20180522_0659.py create mode 100644 src/program/migrations/0058_auto_20180523_0844.py create mode 100644 src/program/migrations/0059_auto_20180523_2241.py create mode 100644 src/program/templates/includes/eventproposalurl_table.html create mode 100644 src/program/templates/includes/speakerproposalurl_table.html create mode 100644 src/program/templates/url_delete.html create mode 100644 src/program/templates/url_form.html diff --git a/src/backoffice/urls.py b/src/backoffice/urls.py index e366e471..24da70f6 100644 --- a/src/backoffice/urls.py +++ b/src/backoffice/urls.py @@ -1,14 +1,14 @@ -from django.conf.urls import url +from django.urls import path from .views import * app_name = 'backoffice' urlpatterns = [ - url(r'^$', BackofficeIndexView.as_view(), name='index'), - url(r'product_handout/$', ProductHandoutView.as_view(), name='product_handout'), - url(r'badge_handout/$', BadgeHandoutView.as_view(), name='badge_handout'), - url(r'ticket_checkin/$', TicketCheckinView.as_view(), name='ticket_checkin'), - url(r'public_credit_names/$', ApproveNamesView.as_view(), name='public_credit_names'), + path('', BackofficeIndexView.as_view(), name='index'), + path('product_handout/', ProductHandoutView.as_view(), name='product_handout'), + path('badge_handout/', BadgeHandoutView.as_view(), name='badge_handout'), + path('ticket_checkin/', TicketCheckinView.as_view(), name='ticket_checkin'), + path('public_credit_names/', ApproveNamesView.as_view(), name='public_credit_names'), ] diff --git a/src/bornhack/urls.py b/src/bornhack/urls.py index 7a2d1957..64d0d351 100644 --- a/src/bornhack/urls.py +++ b/src/bornhack/urls.py @@ -3,7 +3,7 @@ from allauth.account.views import ( LogoutView, ) from django.conf import settings -from django.conf.urls import include, url +from django.urls import include, path from django.contrib import admin from camps.views import * from info.views import * @@ -15,180 +15,180 @@ from people.views import * from bar.views import MenuView urlpatterns = [ - url( - r'^profile/', + path( + 'profile/', include('profiles.urls', namespace='profiles') ), - url( - r'^tickets/', + path( + 'tickets/', include('tickets.urls', namespace='tickets') ), - url( - r'^shop/', + path( + 'shop/', include('shop.urls', namespace='shop') ), - url( - r'^news/', + path( + 'news/', include('news.urls', namespace='news') ), - url( - r'^contact/', + path( + 'contact/', TemplateView.as_view(template_name='contact.html'), name='contact' ), - url( - r'^conduct/', + path( + 'conduct/', TemplateView.as_view(template_name='coc.html'), name='conduct' ), - url( - r'^login/$', + path( + 'login/', LoginView.as_view(), name='account_login', ), - url( - r'^logout/$', + path( + 'logout/', LogoutView.as_view(), name='account_logout', ), - url( - r'^privacy-policy/$', + path( + 'privacy-policy/', TemplateView.as_view(template_name='legal/privacy_policy.html'), name='privacy-policy' ), - url( - r'^general-terms-and-conditions/$', + path( + 'general-terms-and-conditions/', TemplateView.as_view(template_name='legal/general_terms_and_conditions.html'), name='general-terms' ), - url(r'^accounts/', include('allauth.urls')), - url(r'^admin/', admin.site.urls), + path('accounts/', include('allauth.urls')), + path('admin/', admin.site.urls), - url( - r'^camps/$', + path( + 'camps/', CampListView.as_view(), name='camp_list' ), # camp redirect views here - url( - r'^$', + path( + '', CampRedirectView.as_view(), kwargs={'page': 'camp_detail'}, name='camp_detail_redirect', ), - url( - r'^program/$', + path( + 'program/', CampRedirectView.as_view(), kwargs={'page': 'schedule_index'}, name='schedule_index_redirect', ), - url( - r'^info/$', + path( + 'info/', CampRedirectView.as_view(), kwargs={'page': 'info'}, name='info_redirect', ), - url( - r'^sponsors/$', + path( + 'sponsors/', CampRedirectView.as_view(), kwargs={'page': 'sponsors'}, name='sponsors_redirect', ), - url( - r'^villages/$', + path( + 'villages/', CampRedirectView.as_view(), kwargs={'page': 'village_list'}, name='village_list_redirect', ), - url( - r'^people/$', + path( + 'people/', PeopleView.as_view(), name='people', ), - url( - r'^backoffice/', + path( + 'backoffice/', include('backoffice.urls', namespace='backoffice') ), # camp specific urls below here - url( - r'(?P[-_\w+]+)/', include([ - url( - r'^$', + path( + '/', include([ + path( + '', CampDetailView.as_view(), name='camp_detail' ), - url( - r'^info/$', + path( + 'info/', CampInfoView.as_view(), name='info' ), - url( - r'^program/', + path( + 'program/', include('program.urls', namespace='program'), ), - url( - r'^sponsors/call/$', + path( + 'sponsors/call/', CallForSponsorsView.as_view(), name='call-for-sponsors' ), - url( - r'^sponsors/$', + path( + 'sponsors/', SponsorsView.as_view(), name='sponsors' ), - url( - r'^bar/menu$', + path( + 'bar/menu', MenuView.as_view(), name='menu' ), - url( - r'^villages/', include([ - url( - r'^$', + path( + 'villages/', include([ + path( + '', VillageListView.as_view(), name='village_list' ), - url( - r'create/$', + path( + 'create/', VillageCreateView.as_view(), name='village_create' ), - url( - r'(?P[-_\w+]+)/delete/$', + path( + '/delete/', VillageDeleteView.as_view(), name='village_delete' ), - url( - r'(?P[-_\w+]+)/edit/$', + path( + '/edit/', VillageUpdateView.as_view(), name='village_update' ), # this has to be the last url in the list - url( - r'(?P[-_\w+]+)/$', + path( + '/', VillageDetailView.as_view(), name='village_detail' ), ]) ), - url( - r'^teams/', + path( + 'teams/', include('teams.urls', namespace='teams') ), @@ -200,5 +200,6 @@ urlpatterns = [ if settings.DEBUG: import debug_toolbar urlpatterns = [ - url(r'^__debug__/', include(debug_toolbar.urls)), + path('__debug__/', include(debug_toolbar.urls)), ] + urlpatterns + diff --git a/src/news/urls.py b/src/news/urls.py index 6f8d3818..729241b2 100644 --- a/src/news/urls.py +++ b/src/news/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import url +from django.urls import path from . import views app_name = 'news' urlpatterns = [ - url(r'^$', views.NewsIndex.as_view(), kwargs={'archived': False}, name='index'), - url(r'^archive/$', views.NewsIndex.as_view(), kwargs={'archived': True}, name='archive'), - url(r'(?P[-_\w+]+)/$', views.NewsDetail.as_view(), name='detail'), + path('', views.NewsIndex.as_view(), kwargs={'archived': False}, name='index'), + path('archive/', views.NewsIndex.as_view(), kwargs={'archived': True}, name='archive'), + path('/', views.NewsDetail.as_view(), name='detail'), ] diff --git a/src/profiles/urls.py b/src/profiles/urls.py index 8c3f5b07..96af5551 100644 --- a/src/profiles/urls.py +++ b/src/profiles/urls.py @@ -1,10 +1,10 @@ -from django.conf.urls import url +from django.urls import path from .views import ProfileDetail, ProfileUpdate app_name = 'profiles' urlpatterns = [ - url(r'^$', ProfileDetail.as_view(), name='detail'), - url(r'^edit$', ProfileUpdate.as_view(), name='update'), + path('', ProfileDetail.as_view(), name='detail'), + path('edit', ProfileUpdate.as_view(), name='update'), ] diff --git a/src/program/admin.py b/src/program/admin.py index 6611ba98..1686fee3 100644 --- a/src/program/admin.py +++ b/src/program/admin.py @@ -14,7 +14,9 @@ from .models import ( EventTrack, SpeakerProposal, EventProposal, - Favorite + Favorite, + UrlType, + Url ) @@ -98,3 +100,11 @@ class EventAdmin(admin.ModelAdmin): SpeakerInline ] +@admin.register(UrlType) +class UrlTypeAdmin(admin.ModelAdmin): + pass + +@admin.register(Url) +class UrlAdmin(admin.ModelAdmin): + pass + diff --git a/src/program/migrations/0055_auto_20180521_2354.py b/src/program/migrations/0055_auto_20180521_2354.py new file mode 100644 index 00000000..67f2b933 --- /dev/null +++ b/src/program/migrations/0055_auto_20180521_2354.py @@ -0,0 +1,48 @@ +# Generated by Django 2.0.4 on 2018-05-21 21:54 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('program', '0054_auto_20180520_1509'), + ] + + operations = [ + migrations.CreateModel( + name='Url', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created', models.DateTimeField(auto_now_add=True)), + ('updated', models.DateTimeField(auto_now=True)), + ('url', models.URLField(help_text='The actual URL')), + ('event', models.ForeignKey(blank=True, help_text='The event proposal object this URL belongs to', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='urls', to='program.Event')), + ('eventproposal', models.ForeignKey(blank=True, help_text='The event proposal object this URL belongs to', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='urls', to='program.EventProposal')), + ('speaker', models.ForeignKey(blank=True, help_text='The speaker proposal object this URL belongs to', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='urls', to='program.Speaker')), + ('speakerproposal', models.ForeignKey(blank=True, help_text='The speaker proposal object this URL belongs to', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='urls', to='program.SpeakerProposal')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='UrlType', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created', models.DateTimeField(auto_now_add=True)), + ('updated', models.DateTimeField(auto_now=True)), + ('name', models.CharField(help_text='The name of this type', max_length=25)), + ('icon', models.CharField(help_text="Name of the fontawesome icon to use without the 'fa-' part", max_length=100)), + ], + options={ + 'abstract': False, + }, + ), + migrations.AddField( + model_name='url', + name='urltype', + field=models.ForeignKey(help_text='The type of this URL', on_delete=django.db.models.deletion.PROTECT, to='program.UrlType'), + ), + ] diff --git a/src/program/migrations/0056_add_urltypes.py b/src/program/migrations/0056_add_urltypes.py new file mode 100644 index 00000000..1ffea07e --- /dev/null +++ b/src/program/migrations/0056_add_urltypes.py @@ -0,0 +1,58 @@ +# Generated by Django 2.0.4 on 2018-05-21 21:55 + +from django.db import migrations + +def add_urltypes(apps, schema_editor): + UrlType = apps.get_model('program', 'UrlType') + + UrlType.objects.create( + name='Other', + icon='link', + ) + + UrlType.objects.create( + name='Homepage', + icon='link', + ) + + UrlType.objects.create( + name='Slides', + icon='link', + ) + + UrlType.objects.create( + name='Twitter', + icon='link', + ) + + UrlType.objects.create( + name='Mastodon', + icon='link', + ) + + UrlType.objects.create( + name='Facebook', + icon='link', + ) + + UrlType.objects.create( + name='Project', + icon='link', + ) + + UrlType.objects.create( + name='Blog', + icon='link', + ) + + +class Migration(migrations.Migration): + + dependencies = [ + ('program', '0055_auto_20180521_2354'), + ] + + operations = [ + migrations.RunPython(add_urltypes), + ] + diff --git a/src/program/migrations/0057_auto_20180522_0659.py b/src/program/migrations/0057_auto_20180522_0659.py new file mode 100644 index 00000000..910a7f6f --- /dev/null +++ b/src/program/migrations/0057_auto_20180522_0659.py @@ -0,0 +1,18 @@ +# Generated by Django 2.0.4 on 2018-05-22 04:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('program', '0056_add_urltypes'), + ] + + operations = [ + migrations.AlterField( + model_name='urltype', + name='icon', + field=models.CharField(default='link', help_text="Name of the fontawesome icon to use without the 'fa-' part", max_length=100), + ), + ] diff --git a/src/program/migrations/0058_auto_20180523_0844.py b/src/program/migrations/0058_auto_20180523_0844.py new file mode 100644 index 00000000..c6e39171 --- /dev/null +++ b/src/program/migrations/0058_auto_20180523_0844.py @@ -0,0 +1,22 @@ +# Generated by Django 2.0.4 on 2018-05-23 06:44 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('program', '0057_auto_20180522_0659'), + ] + + operations = [ + migrations.AlterModelOptions( + name='urltype', + options={'ordering': ['name']}, + ), + migrations.AlterField( + model_name='urltype', + name='name', + field=models.CharField(help_text='The name of this type', max_length=25, unique=True), + ), + ] diff --git a/src/program/migrations/0059_auto_20180523_2241.py b/src/program/migrations/0059_auto_20180523_2241.py new file mode 100644 index 00000000..a32ae010 --- /dev/null +++ b/src/program/migrations/0059_auto_20180523_2241.py @@ -0,0 +1,23 @@ +# Generated by Django 2.0.4 on 2018-05-23 20:41 + +from django.db import migrations, models +import uuid + + +class Migration(migrations.Migration): + + dependencies = [ + ('program', '0058_auto_20180523_0844'), + ] + + operations = [ + migrations.RemoveField( + model_name='url', + name='id', + ), + migrations.AddField( + model_name='url', + name='uuid', + field=models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False), + ), + ] diff --git a/src/program/mixins.py b/src/program/mixins.py index 89893a2a..2fa7407d 100644 --- a/src/program/mixins.py +++ b/src/program/mixins.py @@ -1,11 +1,9 @@ from django.views.generic.detail import SingleObjectMixin -from django.shortcuts import redirect +from django.shortcuts import redirect, get_object_or_404 from django.urls import reverse from . import models from django.contrib import messages from django.http import Http404, HttpResponse -import sys -import mimetypes class EnsureCFPOpenMixin(object): @@ -55,3 +53,42 @@ class EnsureUserOwnsProposalMixin(SingleObjectMixin): # alright, continue with the request return super().dispatch(request, *args, **kwargs) + +class UrlViewMixin(object): + """ + Mixin with code shared between all the Url views + """ + def dispatch(self, request, *args, **kwargs): + """ + Check that we have a valid SpeakerProposal or EventProposal and that it belongs to the current user + """ + # get the proposal + if 'event_uuid' in self.kwargs: + self.eventproposal = get_object_or_404(models.EventProposal, uuid=self.kwargs['event_uuid'], user=request.user) + elif 'speaker_uuid' in self.kwargs: + self.speakerproposal = get_object_or_404(models.SpeakerProposal, uuid=self.kwargs['speaker_uuid'], user=request.user) + else: + # fuckery afoot + raise Http404 + return super().dispatch(request, *args, **kwargs) + + def get_context_data(self, **kwargs): + """ + Include the proposal in the template context + """ + context = super().get_context_data(**kwargs) + if hasattr(self, 'eventproposal') and self.eventproposal: + context['eventproposal'] = self.eventproposal + else: + context['speakerproposal'] = self.speakerproposal + return context + + def get_success_url(self): + """ + Return to the detail view of the proposal + """ + if hasattr(self, 'eventproposal'): + return self.eventproposal.get_absolute_url() + else: + return self.speakerproposal.get_absolute_url() + diff --git a/src/program/models.py b/src/program/models.py index fd4a8164..653f7a59 100644 --- a/src/program/models.py +++ b/src/program/models.py @@ -15,11 +15,141 @@ from django.core.files.storage import FileSystemStorage from django.urls import reverse from django.apps import apps from django.core.files.base import ContentFile +from django.contrib.contenttypes.fields import GenericForeignKey +from django.contrib.contenttypes.models import ContentType from utils.models import CreatedUpdatedModel, CampRelatedModel + + logger = logging.getLogger("bornhack.%s" % __name__) +class UrlType(CreatedUpdatedModel): + """ + Each Url object has a type. + """ + name = models.CharField( + max_length=25, + help_text='The name of this type', + unique=True, + ) + + icon = models.CharField( + max_length=100, + default='link', + help_text="Name of the fontawesome icon to use without the 'fa-' part" + ) + + class Meta: + ordering = ['name'] + + def __str__(self): + return self.name + + +class Url(CampRelatedModel): + """ + This model contains URLs related to + - SpeakerProposals + - EventProposals + - Speakers + - Events + Each URL has a UrlType and a GenericForeignKey to the model to which it belongs. + When a SpeakerProposal or EventProposal is approved the related URLs will be copied with FK to the new Speaker/Event objects. + """ + uuid = models.UUIDField( + primary_key=True, + default=uuid.uuid4, + editable=False, + ) + + url = models.URLField( + help_text='The actual URL' + ) + + urltype = models.ForeignKey( + 'program.UrlType', + help_text='The type of this URL', + on_delete=models.PROTECT, + ) + + speakerproposal = models.ForeignKey( + 'program.SpeakerProposal', + null=True, + blank=True, + help_text='The speaker proposal object this URL belongs to', + on_delete=models.PROTECT, + related_name='urls', + ) + + eventproposal = models.ForeignKey( + 'program.EventProposal', + null=True, + blank=True, + help_text='The event proposal object this URL belongs to', + on_delete=models.PROTECT, + related_name='urls', + ) + + speaker = models.ForeignKey( + 'program.Speaker', + null=True, + blank=True, + help_text='The speaker proposal object this URL belongs to', + on_delete=models.PROTECT, + related_name='urls', + ) + + event = models.ForeignKey( + 'program.Event', + null=True, + blank=True, + help_text='The event proposal object this URL belongs to', + on_delete=models.PROTECT, + related_name='urls', + ) + + def __str__(self): + return self.url + + def clean(self): + ''' Make sure we have exactly one FK ''' + fks = 0 + if self.speakerproposal: + fks += 1 + if self.eventproposal: + fks += 1 + if self.speaker: + fks += 1 + if self.event: + fks += 1 + if fks > 1: + raise(ValidationError("Url objects must have maximum one FK, this has %s" % fks)) + + @property + def owner(self): + """ + Return the object this Url belongs to + """ + if self.speakerproposal: + return self.speakerproposal + elif self.eventproposal: + return self.eventproposal + elif self.speaker: + return self.speaker + elif self.event: + return self.event + else: + return None + + @property + def camp(self): + return self.owner.camp + + +############################################################################### + + class UserSubmittedModel(CampRelatedModel): """ An abstract model containing the stuff that is shared diff --git a/src/program/templates/eventproposal_detail.html b/src/program/templates/eventproposal_detail.html index 943165bf..8cdc4e47 100644 --- a/src/program/templates/eventproposal_detail.html +++ b/src/program/templates/eventproposal_detail.html @@ -15,7 +15,19 @@

-
Events
+
URLs for {{ eventproposal.title }}
+
+ {% if eventproposal.urls.exists %} + {% include 'includes/eventproposalurl_table.html' %} + {% else %} + Nothing found. + {% endif %} + Add URL +
+
+ +
+
{{ eventproposal.event_type.host_title }} List
{% if eventproposal.speakers.exists %} {% include 'includes/speaker_proposal_table.html' with speakerproposals=eventproposal.speakers.all %} diff --git a/src/program/templates/includes/event_proposal_table.html b/src/program/templates/includes/event_proposal_table.html index 18696705..b6aa3825 100644 --- a/src/program/templates/includes/event_proposal_table.html +++ b/src/program/templates/includes/event_proposal_table.html @@ -3,6 +3,7 @@ Title Type + URLs People Track Status @@ -14,6 +15,7 @@ {{ eventproposal.title }} {{ eventproposal.event_type }} + {% for url in eventproposal.urls.all %} {% empty %}N/A{% endfor %} {% for person in eventproposal.speakers.all %} {% endfor %} {{ eventproposal.track.name }} {{ eventproposal.proposal_status }} @@ -23,6 +25,7 @@ Detail {% if not camp.read_only %} Modify + Add URL {% if eventproposal.get_available_speakerproposals.exists %} Add {{ eventproposal.event_type.host_title }} {% else %} diff --git a/src/program/templates/includes/eventproposalurl_table.html b/src/program/templates/includes/eventproposalurl_table.html new file mode 100644 index 00000000..5af137d2 --- /dev/null +++ b/src/program/templates/includes/eventproposalurl_table.html @@ -0,0 +1,23 @@ + + + + + + + + + + {% for url in eventproposal.urls.all %} + + + + + + {% endfor %} + +
TypeURLsAvailable Actions
{{ url.urltype.name }}{{ url }} + {% if not camp.read_only %} + Update + Delete + {% endif %} +
diff --git a/src/program/templates/includes/speaker_proposal_table.html b/src/program/templates/includes/speaker_proposal_table.html index d656b3eb..8d9dc275 100644 --- a/src/program/templates/includes/speaker_proposal_table.html +++ b/src/program/templates/includes/speaker_proposal_table.html @@ -3,6 +3,7 @@ Name Events + URLs Status Available Actions @@ -20,6 +21,13 @@ N/A {% endif %} + + {% for url in speakerproposal.urls.all %} + + {% empty %} + N/A + {% endfor %} + {{ speakerproposal.proposal_status }}
Detail {% if not camp.read_only %} Modify - Add Event + Add URL {% if not speakerproposal.eventproposals.all %} Delete {% endif %} diff --git a/src/program/templates/includes/speakerproposalurl_table.html b/src/program/templates/includes/speakerproposalurl_table.html new file mode 100644 index 00000000..32e0dfa6 --- /dev/null +++ b/src/program/templates/includes/speakerproposalurl_table.html @@ -0,0 +1,23 @@ + + + + + + + + + + {% for url in speakerproposal.urls.all %} + + + + + + {% endfor %} + +
TypeURLsAvailable Actions
{{ url.urltype.name }}{{ url }} + {% if not camp.read_only %} + Update + Delete + {% endif %} +
diff --git a/src/program/templates/speakerproposal_detail.html b/src/program/templates/speakerproposal_detail.html index bf11bfeb..fec1c34f 100644 --- a/src/program/templates/speakerproposal_detail.html +++ b/src/program/templates/speakerproposal_detail.html @@ -15,7 +15,19 @@
-
Events
+
URLs for {{ speakerproposal.name }}
+
+ {% if speakerproposal.urls.exists %} + {% include 'includes/speakerproposalurl_table.html' %} + {% else %} + Nothing found. + {% endif %} + Add URL +
+
+ +
+
Events for {{ speakerproposal.name }}
{% if speakerproposal.eventproposals.exists %} {% include 'includes/event_proposal_table.html' with eventproposals=speakerproposal.eventproposals.all %} diff --git a/src/program/templates/url_delete.html b/src/program/templates/url_delete.html new file mode 100644 index 00000000..0c7ca6bf --- /dev/null +++ b/src/program/templates/url_delete.html @@ -0,0 +1,19 @@ +{% extends 'program_base.html' %} +{% load bootstrap3 %} + +{% block program_content %} +

Delete URL

+

Really delete this URL? This action cannot be undone.

+ +
+ {% csrf_token %} + {% bootstrap_button " Delete" button_type="submit" button_class="btn-danger" %} + {% if speakerproposal %} + + {% else %} + + {% endif %} + Cancel +
+{% endblock program_content %} + diff --git a/src/program/templates/url_form.html b/src/program/templates/url_form.html new file mode 100644 index 00000000..343a77b7 --- /dev/null +++ b/src/program/templates/url_form.html @@ -0,0 +1,21 @@ +{% extends 'program_base.html' %} +{% load bootstrap3 %} + +{% block program_content %} + +

+ {% if object %} + Update URL + {% else %} + Add URL to {% if speakerproposal %}{{ speakerproposal.name }}{% else %}{{ eventproposal.title }}{% endif %} + {% endif %} +

+ +
+ {% csrf_token %} + {% bootstrap_form form %} + {% bootstrap_button "Save URL" button_type="submit" button_class="btn-primary" %} +
+ +{% endblock program_content %} + diff --git a/src/program/urls.py b/src/program/urls.py index 0861f0d6..1186aefa 100644 --- a/src/program/urls.py +++ b/src/program/urls.py @@ -1,154 +1,184 @@ -from django.conf.urls import include, url +from django.urls import path, include from .views import * app_name = 'program' urlpatterns = [ - url( - r'^$', + path( + '', ScheduleView.as_view(), name='schedule_index' ), - url( - r'^noscript/$', + path( + 'noscript/', NoScriptScheduleView.as_view(), name='noscript_schedule_index' ), - url( - r'^ics/', ICSView.as_view(), name="ics_view" + path( + 'ics/', ICSView.as_view(), name="ics_view" ), - url( - r'^control/', ProgramControlCenter.as_view(), name="program_control_center" + path( + 'control/', ProgramControlCenter.as_view(), name="program_control_center" ), - url( - r'^proposals/', include([ - url( - r'^$', + path( + 'proposals/', include([ + path( + '', ProposalListView.as_view(), name='proposal_list', ), - url( - r'^submit/', include([ - url( - r'^$', + path( + 'submit/', include([ + path( + '', CombinedProposalTypeSelectView.as_view(), name='proposal_combined_type_select', ), - url( - r'^(?P[-_\w+]+)/$', + path( + '/', CombinedProposalSubmitView.as_view(), name='proposal_combined_submit', ), - url( - r'^(?P[-_\w+]+)/select_person/$', + path( + '/select_person/', CombinedProposalPersonSelectView.as_view(), name='proposal_combined_person_select', ), ]), ), - url( - r'^people/', include([ - url( - r'^(?P[a-f0-9-]+)/$', + path( + 'people/', include([ + path( + '/', SpeakerProposalDetailView.as_view(), name='speakerproposal_detail' ), - url( - r'^(?P[a-f0-9-]+)/update/$', + path( + '/update/', SpeakerProposalUpdateView.as_view(), name='speakerproposal_update' ), - url( - r'^(?P[a-f0-9-]+)/delete/$', + path( + '/delete/', SpeakerProposalDeleteView.as_view(), name='speakerproposal_delete' ), - url( - r'^(?P[a-f0-9-]+)/add_event/$', + path( + '/add_event/', EventProposalTypeSelectView.as_view(), name='eventproposal_typeselect' ), - url( - r'^(?P[a-f0-9-]+)/add_event/(?P[-_\w+]+)/$', + path( + '/add_event//', EventProposalCreateView.as_view(), name='eventproposal_create' ), + path( + '/add_url/', + UrlCreateView.as_view(), + name='speakerproposalurl_create' + ), + path( + '/urls//update/', + UrlUpdateView.as_view(), + name='speakerproposalurl_update' + ), + path( + '/urls//delete/', + UrlDeleteView.as_view(), + name='speakerproposalurl_delete' + ), ]) ), - url( - r'^events/', include([ - url( - r'^(?P[a-f0-9-]+)/$', + path( + 'events/', include([ + path( + '/', EventProposalDetailView.as_view(), name='eventproposal_detail' ), - url( - r'^(?P[a-f0-9-]+)/edit/$', + path( + '/update/', EventProposalUpdateView.as_view(), name='eventproposal_update' ), - url( - r'^(?P[a-f0-9-]+)/delete/$', + path( + '/delete/', EventProposalDeleteView.as_view(), name='eventproposal_delete' ), - url( - r'^(?P[a-f0-9-]+)/add_person/$', + path( + '/add_person/', EventProposalSelectPersonView.as_view(), name='eventproposal_selectperson' ), - url( - r'^(?P[a-f0-9-]+)/add_person/new/$', + path( + '/add_person/new/', SpeakerProposalCreateView.as_view(), name='speakerproposal_create' ), - url( - r'^(?P[a-f0-9-]+)/add_person/(?P[a-f0-9-]+)/$', + path( + '/add_person//', EventProposalAddPersonView.as_view(), name='eventproposal_addperson' ), + path( + '/add_url/', + UrlCreateView.as_view(), + name='eventproposalurl_create' + ), + path( + '/urls//update/', + UrlUpdateView.as_view(), + name='eventproposalurl_update' + ), + path( + '/urls//delete/', + UrlDeleteView.as_view(), + name='eventproposalurl_delete' + ), ]) ), ]) ), - url( - r'^speakers/', include([ - url( - r'^$', + path( + 'speakers/', include([ + path( + '', SpeakerListView.as_view(), name='speaker_index' ), - url( - r'^(?P[-_\w+]+)/$', + path( + '/', SpeakerDetailView.as_view(), name='speaker_detail' ), ]), ), - url( - r'^events/$', + path( + 'events/', EventListView.as_view(), name='event_index' ), # legacy CFS url kept on purpose to keep old links functional - url( - r'^call-for-speakers/$', + path( + 'call-for-speakers/', CallForParticipationView.as_view(), name='call_for_speakers' ), - url( - r'^call-for-participation/$', + path( + 'call-for-participation/', CallForParticipationView.as_view(), name='call_for_participation' ), - url( - r'^calendar/', + path( + 'calendar', ICSView.as_view(), name='ics_calendar' ), # this must be the last URL here or the regex will overrule the others - url( - r'^(?P[-_\w+]+)/$', + path( + '', EventDetailView.as_view(), name='event_detail' ), diff --git a/src/program/views.py b/src/program/views.py index 8862f421..10bfcddd 100644 --- a/src/program/views.py +++ b/src/program/views.py @@ -24,7 +24,8 @@ from .mixins import ( EnsureUnapprovedProposalMixin, EnsureUserOwnsProposalMixin, EnsureWritableCampMixin, - EnsureCFPOpenMixin + EnsureCFPOpenMixin, + UrlViewMixin, ) from .email import ( add_speakerproposal_updated_email, @@ -600,3 +601,40 @@ class ProgramControlCenter(CampViewMixin, TemplateView): return context +################################################################################################### +# URL views + +class UrlCreateView(LoginRequiredMixin, CampViewMixin, EnsureWritableCampMixin, EnsureCFPOpenMixin, UrlViewMixin, CreateView): + model = models.Url + template_name = 'url_form.html' + fields = ['urltype', 'url'] + + def form_valid(self, form): + """ + Set the proposal FK before saving + """ + if hasattr(self, 'eventproposal') and self.eventproposal: + form.instance.eventproposal = self.eventproposal + url = form.save() + else: + form.instance.speakerproposal = self.speakerproposal + url = form.save() + + messages.success(self.request, "URL saved.") + + # all good + return redirect(self.get_success_url()) + + +class UrlUpdateView(LoginRequiredMixin, CampViewMixin, EnsureWritableCampMixin, EnsureCFPOpenMixin, UrlViewMixin, UpdateView): + model = models.Url + template_name = 'url_form.html' + fields = ['urltype', 'url'] + pk_url_kwarg = 'url_uuid' + + +class UrlDeleteView(LoginRequiredMixin, CampViewMixin, EnsureWritableCampMixin, EnsureCFPOpenMixin, UrlViewMixin, DeleteView): + model = models.Url + template_name = 'url_delete.html' + pk_url_kwarg = 'url_uuid' + diff --git a/src/shop/urls.py b/src/shop/urls.py index f3ea70c7..061b411c 100644 --- a/src/shop/urls.py +++ b/src/shop/urls.py @@ -1,30 +1,31 @@ -from django.conf.urls import url +from django.urls import path, include from .views import * app_name = 'shop' urlpatterns = [ - url(r'^$', ShopIndexView.as_view(), name='index'), + path('', ShopIndexView.as_view(), name='index'), - url(r'products/(?P[-_\w+]+)/$', ProductDetailView.as_view(), name='product_detail'), + path('products//', ProductDetailView.as_view(), name='product_detail'), - url(r'orders/$', OrderListView.as_view(), name='order_list'), - url(r'orders/(?P[0-9]+)/$', OrderDetailView.as_view(), name='order_detail'), - url(r'orders/(?P[0-9]+)/invoice/$', DownloadInvoiceView.as_view(), name='download_invoice'), - url(r'orders/(?P[0-9]+)/mark_as_paid/$', OrderMarkAsPaidView.as_view(), name='mark_order_as_paid'), + path('orders/', OrderListView.as_view(), name='order_list'), + path('orders//', include([ + path('', OrderDetailView.as_view(), name='order_detail'), + path('invoice/', DownloadInvoiceView.as_view(), name='download_invoice'), + path('mark_as_paid/', OrderMarkAsPaidView.as_view(), name='mark_order_as_paid'), - url(r'orders/(?P[0-9]+)/pay/creditcard/$', EpayFormView.as_view(), name='epay_form'), - url(r'orders/(?P[0-9]+)/pay/creditcard/callback/$',EpayCallbackView.as_view(), name='epay_callback'), - url(r'orders/(?P[0-9]+)/pay/creditcard/thanks/$', EpayThanksView.as_view(), name='epay_thanks'), + path('pay/creditcard/', EpayFormView.as_view(), name='epay_form'), + path('pay/creditcard/callback/',EpayCallbackView.as_view(), name='epay_callback'), + path('pay/creditcard/thanks/', EpayThanksView.as_view(), name='epay_thanks'), - url(r'orders/(?P[0-9]+)/pay/blockchain/$', CoinifyRedirectView.as_view(), name='coinify_pay'), - url(r'orders/(?P[0-9]+)/pay/blockchain/callback/$', CoinifyCallbackView.as_view(), name='coinify_callback'), - url(r'orders/(?P[0-9]+)/pay/blockchain/thanks/$', CoinifyThanksView.as_view(), name='coinify_thanks'), + path('pay/blockchain/', CoinifyRedirectView.as_view(), name='coinify_pay'), + path('pay/blockchain/callback/', CoinifyCallbackView.as_view(), name='coinify_callback'), + path('pay/blockchain/thanks/', CoinifyThanksView.as_view(), name='coinify_thanks'), - url(r'orders/(?P[0-9]+)/pay/banktransfer/$', BankTransferView.as_view(), name='bank_transfer'), + path('pay/banktransfer/', BankTransferView.as_view(), name='bank_transfer'), - url(r'orders/(?P[0-9]+)/pay/cash/$', CashView.as_view(), name='cash'), - - url(r'creditnotes/$', CreditNoteListView.as_view(), name='creditnote_list'), - url(r'creditnotes/(?P[0-9]+)/pdf/$', DownloadCreditNoteView.as_view(), name='download_creditnote'), + path('pay/cash/', CashView.as_view(), name='cash'), + ])), + path('creditnotes/', CreditNoteListView.as_view(), name='creditnote_list'), + path('creditnotes//pdf/', DownloadCreditNoteView.as_view(), name='download_creditnote'), ] diff --git a/src/teams/urls.py b/src/teams/urls.py index eecc5acc..6212f1f1 100644 --- a/src/teams/urls.py +++ b/src/teams/urls.py @@ -1,72 +1,72 @@ -from django.conf.urls import url, include +from django.urls import path, include from .views import * app_name = 'teams' urlpatterns = [ - url( - r'^$', + path( + '', TeamListView.as_view(), name='list' ), - url( - r'^members/', include([ - url( - r'^(?P[0-9]+)/remove/$', + path( + 'members/', include([ + path( + '/remove/', TeamMemberRemoveView.as_view(), name='teammember_remove', ), - url( - r'^(?P[0-9]+)/approve/$', + path( + '/approve/', TeamMemberApproveView.as_view(), name='teammember_approve', ), ]), ), - url( - r'^(?P[-_\w+]+)/', include([ - url( - r'^$', + path( + '/', include([ + path( + '', TeamDetailView.as_view(), name='detail' ), - url( - r'^join/$', + path( + 'join/', TeamJoinView.as_view(), name='join' ), - url( - r'^leave/$', + path( + 'leave/', TeamLeaveView.as_view(), name='leave' ), - url( - r'^manage/$', + path( + 'manage/', TeamManageView.as_view(), name='manage' ), - url( - r'^fix_irc_acl/$', + path( + 'fix_irc_acl/', FixIrcAclView.as_view(), name='fix_irc_acl', ), - url( - r'^tasks/', include([ - url( - r'^create/$', + path( + 'tasks/', include([ + path( + 'create/', TaskCreateView.as_view(), name='task_create', ), - url( - r'^(?P[-_\w+]+)/', include([ - url( - r'^$', + path( + '/', include([ + path( + '', TaskDetailView.as_view(), name='task_detail', ), - url( - r'^update/$', + path( + 'update/', TaskUpdateView.as_view(), name='task_update', ), diff --git a/src/tickets/urls.py b/src/tickets/urls.py index 9ef1ffbe..e6d40f9c 100644 --- a/src/tickets/urls.py +++ b/src/tickets/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import url +from django.urls import path from .views import ( ShopTicketListView, @@ -9,18 +9,18 @@ from .views import ( app_name = 'tickets' urlpatterns = [ - url( - r'^$', + path( + '', ShopTicketListView.as_view(), name='shopticket_list' ), - url( - r'^(?P\b[0-9A-Fa-f]{8}\b(-\b[0-9A-Fa-f]{4}\b){3}-\b[0-9A-Fa-f]{12}\b)/download/$', + path( + '/download/', ShopTicketDownloadView.as_view(), name='shopticket_download' ), - url( - r'^(?P\b[0-9A-Fa-f]{8}\b(-\b[0-9A-Fa-f]{4}\b){3}-\b[0-9A-Fa-f]{12}\b)/edit/$', + path( + '/edit/', ShopTicketDetailView.as_view(), name='shopticket_edit' ), diff --git a/src/villages/urls.py b/src/villages/urls.py index cf06449b..a36c5a13 100644 --- a/src/villages/urls.py +++ b/src/villages/urls.py @@ -1,13 +1,13 @@ -from django.conf.urls import url +from django.urls import path from .views import * app_name = 'villages' urlpatterns = [ - url(r'^$', VillageListView.as_view(), name='list'), - url(r'create/$', VillageCreateView.as_view(), name='create'), - url(r'(?P[-_\w+]+)/delete/$', VillageDeleteView.as_view(), name='delete'), - url(r'(?P[-_\w+]+)/edit/$', VillageUpdateView.as_view(), name='update'), - url(r'(?P[-_\w+]+)/$', VillageDetailView.as_view(), name='detail'), + path('', VillageListView.as_view(), name='list'), + path('create/', VillageCreateView.as_view(), name='create'), + path('/delete/', VillageDeleteView.as_view(), name='delete'), + path('/edit/', VillageUpdateView.as_view(), name='update'), + path('/', VillageDetailView.as_view(), name='detail'), ] From 3e12c98b9546181815e8c2cf6fff4d01b40c1573 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Wed, 23 May 2018 23:34:54 +0200 Subject: [PATCH 13/18] for some reason all our test users were is_staff=True users --- src/utils/management/commands/bootstrap-devsite.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/utils/management/commands/bootstrap-devsite.py b/src/utils/management/commands/bootstrap-devsite.py index 29df775a..2c4bbbd6 100644 --- a/src/utils/management/commands/bootstrap-devsite.py +++ b/src/utils/management/commands/bootstrap-devsite.py @@ -127,7 +127,6 @@ class Command(BaseCommand): user2 = User.objects.create_user( username='user2', password='user2', - is_staff=True ) user2.profile.name = 'Jane Doe' user2.profile.description = 'one that once was' @@ -143,7 +142,6 @@ class Command(BaseCommand): user3 = User.objects.create_user( username='user3', password='user3', - is_staff=True ) user3.profile.name = 'Lorem Ipsum' user3.profile.description = 'just a user' @@ -160,7 +158,6 @@ class Command(BaseCommand): user4 = User.objects.create_user( username='user4', password='user4', - is_staff=True ) user4.profile.name = 'Ethe Reum' user4.profile.description = 'I prefer doge' @@ -178,7 +175,6 @@ class Command(BaseCommand): user5 = User.objects.create_user( username='user5', password='user5', - is_staff=True ) user5.profile.name = 'Pyra Mid' user5.profile.description = 'This is not a scam' @@ -196,7 +192,6 @@ class Command(BaseCommand): user6 = User.objects.create_user( username='user6', password='user6', - is_staff=True ) user6.profile.name = 'User Number 6' user6.profile.description = 'some description' @@ -214,7 +209,6 @@ class Command(BaseCommand): user7 = User.objects.create_user( username='user7', password='user7', - is_staff=True ) user7.profile.name = 'Assembly Hacker' user7.profile.description = 'Low level is best level' @@ -232,7 +226,6 @@ class Command(BaseCommand): user8 = User.objects.create_user( username='user8', password='user8', - is_staff=True ) user8.profile.name = 'TCL' user8.profile.description = 'Expect me' @@ -250,7 +243,6 @@ class Command(BaseCommand): user9 = User.objects.create_user( username='user9', password='user9', - is_staff=True ) user9.profile.name = 'John Windows' user9.profile.description = 'Microsoft is best soft' From 1f584719276617213eb1fef0a68f8c3ed333bf44 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Thu, 24 May 2018 10:23:42 +0200 Subject: [PATCH 14/18] default allow_video_recording to checked --- src/program/forms.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/program/forms.py b/src/program/forms.py index 8c74b883..e13d28be 100644 --- a/src/program/forms.py +++ b/src/program/forms.py @@ -43,6 +43,9 @@ class BaseEventProposalForm(forms.ModelForm): # disable the empty_label for the track select box self.fields['track'].empty_label = None + # make sure video_recording checkbox defaults to checked + self.fields['allow_video_recording'].initial = True + ################################ EventType "Talk" ################################################ From 157050d30e9182751a5556248b19bc10b128ad5d Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Thu, 24 May 2018 11:43:46 +0200 Subject: [PATCH 15/18] make it possible to remove a speakerproposal from an eventproposal, move proposal delete buttons to the proposal detail pages, fix a button here and there --- .../event_proposal_remove_person.html | 15 +++++ .../templates/eventproposal_detail.html | 8 ++- .../includes/event_proposal_table.html | 1 - .../includes/speaker_proposal_table.html | 6 +- src/program/templates/proposal_delete.html | 2 +- .../templates/speakerproposal_detail.html | 3 + src/program/urls.py | 5 ++ src/program/views.py | 59 +++++++++++++++++++ 8 files changed, 93 insertions(+), 6 deletions(-) create mode 100644 src/program/templates/event_proposal_remove_person.html diff --git a/src/program/templates/event_proposal_remove_person.html b/src/program/templates/event_proposal_remove_person.html new file mode 100644 index 00000000..9adf37da --- /dev/null +++ b/src/program/templates/event_proposal_remove_person.html @@ -0,0 +1,15 @@ +{% extends 'program_base.html' %} +{% load bootstrap3 %} + +{% block program_content %} +

Remove "{{ speakerproposal.name }}" from "{{ eventproposal.title }}"?

+

Really remove this {{ eventproposal.event_type.host_title }} from this event?

+ +
+ {% csrf_token %} + {% bootstrap_button " Remove" button_type="submit" button_class="btn-danger" %} + {% bootstrap_button " Cancel" button_type="link" button_class="btn-primary" %} +
+ +{% endblock program_content %} + diff --git a/src/program/templates/eventproposal_detail.html b/src/program/templates/eventproposal_detail.html index 8cdc4e47..30ff479d 100644 --- a/src/program/templates/eventproposal_detail.html +++ b/src/program/templates/eventproposal_detail.html @@ -27,18 +27,24 @@
-
{{ eventproposal.event_type.host_title }} List
+
{{ eventproposal.event_type.host_title }} List for {{ eventproposal.title }}
{% if eventproposal.speakers.exists %} {% include 'includes/speaker_proposal_table.html' with speakerproposals=eventproposal.speakers.all %} {% else %} Nothing found. {% endif %} + {% if eventproposal.get_available_speakerproposals.exists %} + Add {{ eventproposal.event_type.host_title }} + {% else %} + Add {{ eventproposal.event_type.host_title }} + {% endif %}

Back to List + Delete

{% endblock program_content %} diff --git a/src/program/templates/includes/event_proposal_table.html b/src/program/templates/includes/event_proposal_table.html index b6aa3825..7bc954a0 100644 --- a/src/program/templates/includes/event_proposal_table.html +++ b/src/program/templates/includes/event_proposal_table.html @@ -31,7 +31,6 @@ {% else %} Add {{ eventproposal.event_type.host_title }} {% endif %} - Delete {% endif %} diff --git a/src/program/templates/includes/speaker_proposal_table.html b/src/program/templates/includes/speaker_proposal_table.html index 8d9dc275..fea5d254 100644 --- a/src/program/templates/includes/speaker_proposal_table.html +++ b/src/program/templates/includes/speaker_proposal_table.html @@ -35,10 +35,10 @@ Detail {% if not camp.read_only %} Modify - Add URL - {% if not speakerproposal.eventproposals.all %} - Delete + {% if eventproposal and eventproposal.speakers.count > 1 %} + Remove {% endif %} + Add URL {% endif %} diff --git a/src/program/templates/proposal_delete.html b/src/program/templates/proposal_delete.html index 489cabcb..89842635 100644 --- a/src/program/templates/proposal_delete.html +++ b/src/program/templates/proposal_delete.html @@ -12,7 +12,7 @@
{% csrf_token %} {% bootstrap_button " Delete" button_type="submit" button_class="btn-danger" %} - {% bootstrap_button " Cancel" button_type="link" button_class="btn-primary" %} + Cancel
{% endblock program_content %} diff --git a/src/program/templates/speakerproposal_detail.html b/src/program/templates/speakerproposal_detail.html index fec1c34f..a8b657d5 100644 --- a/src/program/templates/speakerproposal_detail.html +++ b/src/program/templates/speakerproposal_detail.html @@ -39,6 +39,9 @@

Back to List + {% if not speakerproposal.eventproposals.all %} + Delete Person + {% endif %}

{% endblock program_content %} diff --git a/src/program/urls.py b/src/program/urls.py index 1186aefa..c4d7cb69 100644 --- a/src/program/urls.py +++ b/src/program/urls.py @@ -122,6 +122,11 @@ urlpatterns = [ EventProposalAddPersonView.as_view(), name='eventproposal_addperson' ), + path( + '/remove_person//', + EventProposalRemovePersonView.as_view(), + name='eventproposal_removeperson' + ), path( '/add_url/', UrlCreateView.as_view(), diff --git a/src/program/views.py b/src/program/views.py index 10bfcddd..1b776543 100644 --- a/src/program/views.py +++ b/src/program/views.py @@ -287,6 +287,65 @@ class EventProposalAddPersonView(LoginRequiredMixin, CampViewMixin, EnsureWritab return reverse('program:proposal_list', kwargs={'camp_slug': self.camp.slug}) +class EventProposalRemovePersonView(LoginRequiredMixin, CampViewMixin, EnsureWritableCampMixin, EnsureCFPOpenMixin, UpdateView): + """ + This view is for removing a speakerproposal from an existing eventproposal + """ + model = models.EventProposal + template_name = 'event_proposal_remove_person.html' + fields = [] + pk_url_kwarg = 'event_uuid' + + def dispatch(self, request, *args, **kwargs): + """ Get the speakerproposal object and check a few things """ + # get the speakerproposal object from URL kwargs + self.speakerproposal = get_object_or_404(models.SpeakerProposal, pk=kwargs['speaker_uuid'], user=request.user) + # run the super() dispatch method so we have self.camp otherwise the .all() lookup below craps out + response = super().dispatch(request, *args, **kwargs) + + # is this speakerproposal even in use on this eventproposal + if self.speakerproposal not in self.get_object().speakers.all(): + # this speaker is not associated with this event + raise Http404 + + # all good + return response + + def get_context_data(self, *args, **kwargs): + """ Make speakerproposal object available in template """ + context = super().get_context_data(**kwargs) + context['speakerproposal'] = self.speakerproposal + return context + + def form_valid(self, form): + """ Remove the speaker from the event """ + if self.speakerproposal not in self.get_object().speakers.all(): + # this speaker is not associated with this event + raise Http404 + + if self.get_object().speakers.count() == 1: + messages.error(self.request, "Cannot delete the last person associalted with event!") + return redirect(reverse( + 'program:eventproposal_detail', kwargs={ + 'camp_slug': self.camp.slug, + 'pk': self.get_object().uuid + })) + + form.instance.speakers.remove(self.speakerproposal) + return redirect(self.get_success_url()) + + def get_success_url(self): + messages.success(self.request, "Speaker %s has been removed from %s" % ( + self.speakerproposal.name, + self.get_object().title + )) + return reverse( + 'program:eventproposal_detail', kwargs={ + 'camp_slug': self.camp.slug, + 'pk': self.get_object().uuid + }) + + class EventProposalCreateView(LoginRequiredMixin, CampViewMixin, EnsureWritableCampMixin, EnsureCFPOpenMixin, CreateView): """ This view allows a user to create a new eventproposal linked to an existing speakerproposal From eb807a68536db2afac977d523e7d660b3c65d30d Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Fri, 25 May 2018 14:27:53 +0200 Subject: [PATCH 16/18] move call for participation from template to the database, prepare to move call for sponsors in the same way. This commit means we will need to copy the content of the old templates to the prod db after deploy --- .../migrations/0027_auto_20180525_1019.py | 23 ++++++++ .../migrations/0028_auto_20180525_1025.py | 23 ++++++++ src/camps/models.py | 12 ++++ .../bornhack-2016_call_for_participation.html | 56 ------------------ .../bornhack-2016_call_for_speakers.html | 56 ------------------ .../bornhack-2017_call_for_participation.html | 58 ------------------- .../bornhack-2017_call_for_speakers.html | 58 ------------------- .../bornhack-2018_call_for_participation.html | 11 ---- .../bornhack-2018_call_for_speakers.html | 11 ---- .../bornhack-2019_call_for_participation.html | 1 - .../bornhack-2019_call_for_speakers.html | 1 - .../templates/call_for_participation.html | 17 ++++++ .../templates/includes/program_menu.html | 8 ++- src/program/templates/proposal_list.html | 9 ++- src/program/views.py | 11 +++- 15 files changed, 97 insertions(+), 258 deletions(-) create mode 100644 src/camps/migrations/0027_auto_20180525_1019.py create mode 100644 src/camps/migrations/0028_auto_20180525_1025.py delete mode 100644 src/program/templates/bornhack-2016_call_for_participation.html delete mode 100644 src/program/templates/bornhack-2016_call_for_speakers.html delete mode 100644 src/program/templates/bornhack-2017_call_for_participation.html delete mode 100644 src/program/templates/bornhack-2017_call_for_speakers.html delete mode 100644 src/program/templates/bornhack-2018_call_for_participation.html delete mode 100644 src/program/templates/bornhack-2018_call_for_speakers.html delete mode 100644 src/program/templates/bornhack-2019_call_for_participation.html delete mode 100644 src/program/templates/bornhack-2019_call_for_speakers.html create mode 100644 src/program/templates/call_for_participation.html diff --git a/src/camps/migrations/0027_auto_20180525_1019.py b/src/camps/migrations/0027_auto_20180525_1019.py new file mode 100644 index 00000000..daf8db5b --- /dev/null +++ b/src/camps/migrations/0027_auto_20180525_1019.py @@ -0,0 +1,23 @@ +# Generated by Django 2.0.4 on 2018-05-25 08:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('camps', '0026_auto_20180506_1633'), + ] + + operations = [ + migrations.AddField( + model_name='camp', + name='call_for_participation', + field=models.TextField(blank=True, help_text='The CFP markdown for this Camp'), + ), + migrations.AddField( + model_name='camp', + name='call_for_sponsors', + field=models.TextField(blank=True, help_text='The CFS markdown for this Camp'), + ), + ] diff --git a/src/camps/migrations/0028_auto_20180525_1025.py b/src/camps/migrations/0028_auto_20180525_1025.py new file mode 100644 index 00000000..e7976e32 --- /dev/null +++ b/src/camps/migrations/0028_auto_20180525_1025.py @@ -0,0 +1,23 @@ +# Generated by Django 2.0.4 on 2018-05-25 08:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('camps', '0027_auto_20180525_1019'), + ] + + operations = [ + migrations.AlterField( + model_name='camp', + name='call_for_participation', + field=models.TextField(blank=True, default='The Call For Participation for this Camp has not been written yet', help_text='The CFP markdown for this Camp'), + ), + migrations.AlterField( + model_name='camp', + name='call_for_sponsors', + field=models.TextField(blank=True, default='The Call For Sponsors for this Camp has not been written yet', help_text='The CFS markdown for this Camp'), + ), + ] diff --git a/src/camps/models.py b/src/camps/models.py index 5ea46c30..196ee48c 100644 --- a/src/camps/models.py +++ b/src/camps/models.py @@ -70,11 +70,23 @@ class Camp(CreatedUpdatedModel, UUIDModel): default=False, ) + call_for_participation = models.TextField( + blank=True, + help_text='The CFP markdown for this Camp', + default='The Call For Participation for this Camp has not been written yet', + ) + call_for_sponsors_open = models.BooleanField( help_text='Check if the Call for Sponsors is open for this camp', default=False, ) + call_for_sponsors = models.TextField( + blank=True, + help_text='The CFS markdown for this Camp', + default='The Call For Sponsors for this Camp has not been written yet', + ) + def get_absolute_url(self): return reverse('camp_detail', kwargs={'camp_slug': self.slug}) diff --git a/src/program/templates/bornhack-2016_call_for_participation.html b/src/program/templates/bornhack-2016_call_for_participation.html deleted file mode 100644 index 7d47f74e..00000000 --- a/src/program/templates/bornhack-2016_call_for_participation.html +++ /dev/null @@ -1,56 +0,0 @@ -{% extends 'program_base.html' %} - -{% block title %} -Call for Speakers | {{ block.super }} -{% endblock %} - -{% block program_content %} - -{% if not camp.call_for_participation_open %} -
- Note! This Call for Speakers is no longer relevant. It is kept here for historic purposes. -
-{% endif %} - -

BornHack 2016: Call for Speakers

- -

BornHack 2016 is a 7 days outdoor technology tent camping festival that will take place from the 27th of August to the 3rd of September 2016 on the island of Bornholm in Denmark. It is first time that BornHack will take place and it is our goal to make BornHack a yearly recurring event with 100 to 350 participants.

- -

We are looking for gifted, entertaining and technically enlightening speakers to host talks, lightning talks and workshops at BornHack.

- -

Please reach out to us on speakers@bornhack.dk with a title, abstract, biography, an optional picture of yourself and whether it is a regular talk, lightning talk, workshop or something entirely different. Please ensure that all information is in English. The submitted information will be published both as a news entry and in the official event program on our website, if the submission is accepted.

- -

We are very open to different topics. We expect that the majority of the presentation at BornHack will be on security, networking, programming, distributed systems, privacy, and how these technologies relate to society.

- -

The ticket shop for BornHack 2016 is already open and available at https://bornhack.dk/shop/ - please make sure you have also read our Code of Conduct.

- -

Regular Talk

- -

Regular talks are 45 minutes of presentation, 10 minutes of questions from the audience followed by 5 minutes of preparation for setting up the next speaker.

- -

Please bring your own laptop with your presentation on; it should have an HDMI socket and we will provide the cable to the projector. We do not guarantee that audio will work, even if your laptop supports that.

- -

We will provide you with a one-day entrance ticket free of charge, but due to our limited funds, you would have to pay for transportation to and from the event yourself. We also encourage you to participate for the entire week, but you would also have to pay for the ticket yourself.

- -

Lightning Talk

- -

Lightning talks are 10 minutes of presentation. A laptop will be connected to the projector at the location of the presentations.

- -

A lightning talk is an excellent opportunity for inexperienced speakers to present a topic that you find interesting.

- -

You MUST buy yourself an entrance ticket to host a lightning talk; we are unable to offer free tickets for everyone that gives a lightning talk.

- -

Workshop

- -

We have two workshop areas that will be able to host workshops for approximately 20 people per room. Workshops can be up to 3 hours per slot and can be extended for daily workshops.

- -

You MUST buy yourself an entrance ticket to host a workshop; we are unable to offer free tickets for everyone that hosts a workshop.

- -

Contact Information

- -

The BornHack speakers team can be contacted via speakers@bornhack.dk - for general information reach out to the info team via info@bornhack.dk

- -

We are also reachable via IRC in #BornHack on irc.baconsvin.org or 6nbtgccn5nbcodn3.onion - both listening for TLS connections on port 6697.

- -

For more information, please have a look at https://bornhack.dk/ or follow us on Twitter at @bornhax.

-{% endblock %} diff --git a/src/program/templates/bornhack-2016_call_for_speakers.html b/src/program/templates/bornhack-2016_call_for_speakers.html deleted file mode 100644 index 251995fc..00000000 --- a/src/program/templates/bornhack-2016_call_for_speakers.html +++ /dev/null @@ -1,56 +0,0 @@ -{% extends 'program_base.html' %} - -{% block title %} -Call for Speakers | {{ block.super }} -{% endblock %} - -{% block program_content %} - -{% if not camp.call_for_speakers_open %} -
- Note! This Call for Speakers is no longer relevant. It is kept here for historic purposes. -
-{% endif %} - -

BornHack 2016: Call for Speakers

- -

BornHack 2016 is a 7 days outdoor technology tent camping festival that will take place from the 27th of August to the 3rd of September 2016 on the island of Bornholm in Denmark. It is first time that BornHack will take place and it is our goal to make BornHack a yearly recurring event with 100 to 350 participants.

- -

We are looking for gifted, entertaining and technically enlightening speakers to host talks, lightning talks and workshops at BornHack.

- -

Please reach out to us on speakers@bornhack.dk with a title, abstract, biography, an optional picture of yourself and whether it is a regular talk, lightning talk, workshop or something entirely different. Please ensure that all information is in English. The submitted information will be published both as a news entry and in the official event program on our website, if the submission is accepted.

- -

We are very open to different topics. We expect that the majority of the presentation at BornHack will be on security, networking, programming, distributed systems, privacy, and how these technologies relate to society.

- -

The ticket shop for BornHack 2016 is already open and available at https://bornhack.dk/shop/ - please make sure you have also read our Code of Conduct.

- -

Regular Talk

- -

Regular talks are 45 minutes of presentation, 10 minutes of questions from the audience followed by 5 minutes of preparation for setting up the next speaker.

- -

Please bring your own laptop with your presentation on; it should have an HDMI socket and we will provide the cable to the projector. We do not guarantee that audio will work, even if your laptop supports that.

- -

We will provide you with a one-day entrance ticket free of charge, but due to our limited funds, you would have to pay for transportation to and from the event yourself. We also encourage you to participate for the entire week, but you would also have to pay for the ticket yourself.

- -

Lightning Talk

- -

Lightning talks are 10 minutes of presentation. A laptop will be connected to the projector at the location of the presentations.

- -

A lightning talk is an excellent opportunity for inexperienced speakers to present a topic that you find interesting.

- -

You MUST buy yourself an entrance ticket to host a lightning talk; we are unable to offer free tickets for everyone that gives a lightning talk.

- -

Workshop

- -

We have two workshop areas that will be able to host workshops for approximately 20 people per room. Workshops can be up to 3 hours per slot and can be extended for daily workshops.

- -

You MUST buy yourself an entrance ticket to host a workshop; we are unable to offer free tickets for everyone that hosts a workshop.

- -

Contact Information

- -

The BornHack speakers team can be contacted via speakers@bornhack.dk - for general information reach out to the info team via info@bornhack.dk

- -

We are also reachable via IRC in #BornHack on irc.baconsvin.org or 6nbtgccn5nbcodn3.onion - both listening for TLS connections on port 6697.

- -

For more information, please have a look at https://bornhack.dk/ or follow us on Twitter at @bornhax.

-{% endblock %} diff --git a/src/program/templates/bornhack-2017_call_for_participation.html b/src/program/templates/bornhack-2017_call_for_participation.html deleted file mode 100644 index f94cba5d..00000000 --- a/src/program/templates/bornhack-2017_call_for_participation.html +++ /dev/null @@ -1,58 +0,0 @@ -{% extends 'program_base.html' %} - -{% block title %} -Call for Speakers | {{ block.super }} -{% endblock %} - -{% block program_content %} - -{% if not camp.call_for_participation_open %} -
- Note! This Call for Speakers is no longer relevant. It is kept here for historic purposes. -
-{% endif %} - -

Call for Speakers

-

We are looking for gifted, talented, humourous, technically enlightened speakers to host talks, lightning talks, and workshops at BornHack.

- -

We are very open to different topics. We expect that the majority of the presentation at BornHack will be on security, networking, programming, distributed systems, privacy, and how these technologies relate to society.

- -

BornHack is trying to be an inclusive event so please make sure you have read and understood our Code of Conduct.

- -

Regular Talk

-

Regular talks are 45 minutes of presentation, 10 minutes of questions from the audience followed by 5 minutes of preparation for setting up the next speaker.

- -

Please bring your own laptop with your presentation on; it should have an ordinary HDMI output and we will provide the cable to the projector. We do not guarantee that audio will work, even if your laptop supports it - please reach out to us early if this is a requirement.

- -

We will provide speakers with a one-day entrance ticket free of charge, but due to our limited funds, you would have to pay for transportation to and from the event yourself. We also encourage speakers to participate for the entire week, but you will have to pay for the full ticket yourself.

- -

Lightning Talk

-

Lightning talks are 10 minutes of presentation. A laptop will be connected to the projector at the location of the presentations.

- -

A lightning talk is an excellent opportunity for inexperienced speakers to share an interesting idea, presentation, or maybe just a small story.

- -

You must buy an entrance ticket to host a lightning talk; we are unable to offer free tickets for lightning talks.

- -

Workshops

-

We have two workshop areas that will be able to host workshops for approximately 20 people per room. Workshops can be up to 3 hours per slot and can be extended to full day workshops.

- -

You must buy an entrance ticket to host a workshop; we are unable to offer free tickets for workshops.

- -

Submitting Content

-

Please submit content for BornHack 2017 as early as possible. You can submit content via our website:

- -
    -
  1. Create a user account on the BornHack website
  2. -
  3. Visit the proposals page
  4. -
  5. Propose a new speaker
  6. -
  7. Propose a new event
  8. -
- -

We will review incoming proposals and notify you as early as possible on whether the proposal was accepted or not. Proposals submitted before 1st of July will be notified by us no later than the 16th of July. Late submissions are welcome, but we might be running low on available slots at that time.

- -

Contact Information

-

The BornHack content team can be reached at content@bornhack.dk - for general questions regarding the event please reach out to the info team at info@bornhack.dk

- -

We are reachable via IRC in #BornHack on irc.baconsvin.org (6nbtgccn5nbcodn3.onion) on port 6697 with TLS, you can also follow us on Twitter at @bornhax.

- -{% endblock %} diff --git a/src/program/templates/bornhack-2017_call_for_speakers.html b/src/program/templates/bornhack-2017_call_for_speakers.html deleted file mode 100644 index 80e03280..00000000 --- a/src/program/templates/bornhack-2017_call_for_speakers.html +++ /dev/null @@ -1,58 +0,0 @@ -{% extends 'program_base.html' %} - -{% block title %} -Call for Speakers | {{ block.super }} -{% endblock %} - -{% block program_content %} - -{% if not camp.call_for_speakers_open %} -
- Note! This Call for Speakers is no longer relevant. It is kept here for historic purposes. -
-{% endif %} - -

Call for Speakers

-

We are looking for gifted, talented, humourous, technically enlightened speakers to host talks, lightning talks, and workshops at BornHack.

- -

We are very open to different topics. We expect that the majority of the presentation at BornHack will be on security, networking, programming, distributed systems, privacy, and how these technologies relate to society.

- -

BornHack is trying to be an inclusive event so please make sure you have read and understood our Code of Conduct.

- -

Regular Talk

-

Regular talks are 45 minutes of presentation, 10 minutes of questions from the audience followed by 5 minutes of preparation for setting up the next speaker.

- -

Please bring your own laptop with your presentation on; it should have an ordinary HDMI output and we will provide the cable to the projector. We do not guarantee that audio will work, even if your laptop supports it - please reach out to us early if this is a requirement.

- -

We will provide speakers with a one-day entrance ticket free of charge, but due to our limited funds, you would have to pay for transportation to and from the event yourself. We also encourage speakers to participate for the entire week, but you will have to pay for the full ticket yourself.

- -

Lightning Talk

-

Lightning talks are 10 minutes of presentation. A laptop will be connected to the projector at the location of the presentations.

- -

A lightning talk is an excellent opportunity for inexperienced speakers to share an interesting idea, presentation, or maybe just a small story.

- -

You must buy an entrance ticket to host a lightning talk; we are unable to offer free tickets for lightning talks.

- -

Workshops

-

We have two workshop areas that will be able to host workshops for approximately 20 people per room. Workshops can be up to 3 hours per slot and can be extended to full day workshops.

- -

You must buy an entrance ticket to host a workshop; we are unable to offer free tickets for workshops.

- -

Submitting Content

-

Please submit content for BornHack 2017 as early as possible. You can submit content via our website:

- -
    -
  1. Create a user account on the BornHack website
  2. -
  3. Visit the proposals page
  4. -
  5. Propose a new speaker
  6. -
  7. Propose a new event
  8. -
- -

We will review incoming proposals and notify you as early as possible on whether the proposal was accepted or not. Proposals submitted before 1st of July will be notified by us no later than the 16th of July. Late submissions are welcome, but we might be running low on available slots at that time.

- -

Contact Information

-

The BornHack content team can be reached at content@bornhack.dk - for general questions regarding the event please reach out to the info team at info@bornhack.dk

- -

We are reachable via IRC in #BornHack on irc.baconsvin.org (6nbtgccn5nbcodn3.onion) on port 6697 with TLS, you can also follow us on Twitter at @bornhax.

- -{% endblock %} diff --git a/src/program/templates/bornhack-2018_call_for_participation.html b/src/program/templates/bornhack-2018_call_for_participation.html deleted file mode 100644 index 665d6033..00000000 --- a/src/program/templates/bornhack-2018_call_for_participation.html +++ /dev/null @@ -1,11 +0,0 @@ -{% extends 'program_base.html' %} - -{% block title %} -Call for Participation | {{ block.super }} -{% endblock %} - -{% block program_content %} - -

Call for Participation coming soon!

- -{% endblock %} diff --git a/src/program/templates/bornhack-2018_call_for_speakers.html b/src/program/templates/bornhack-2018_call_for_speakers.html deleted file mode 100644 index 1e2c8e6a..00000000 --- a/src/program/templates/bornhack-2018_call_for_speakers.html +++ /dev/null @@ -1,11 +0,0 @@ -{% extends 'program_base.html' %} - -{% block title %} -Call for Speakers | {{ block.super }} -{% endblock %} - -{% block program_content %} - -

Call for Speakers coming eventually!

- -{% endblock %} diff --git a/src/program/templates/bornhack-2019_call_for_participation.html b/src/program/templates/bornhack-2019_call_for_participation.html deleted file mode 100644 index 4a5180a5..00000000 --- a/src/program/templates/bornhack-2019_call_for_participation.html +++ /dev/null @@ -1 +0,0 @@ -program/templates/bornhack-2019_call_for_speakers.html \ No newline at end of file diff --git a/src/program/templates/bornhack-2019_call_for_speakers.html b/src/program/templates/bornhack-2019_call_for_speakers.html deleted file mode 100644 index 4a5180a5..00000000 --- a/src/program/templates/bornhack-2019_call_for_speakers.html +++ /dev/null @@ -1 +0,0 @@ -program/templates/bornhack-2019_call_for_speakers.html \ No newline at end of file diff --git a/src/program/templates/call_for_participation.html b/src/program/templates/call_for_participation.html new file mode 100644 index 00000000..ee865f22 --- /dev/null +++ b/src/program/templates/call_for_participation.html @@ -0,0 +1,17 @@ +{% extends 'program_base.html' %} + +{% block title %} +Call for Participation | {{ block.super }} +{% endblock %} + +{% block program_content %} + +{% if not camp.call_for_participation_open %} +
+ Note! This Call for Particilation is not open. +
+{% endif %} + +{{ cfp_markdown|safe }} + +{% endblock %} diff --git a/src/program/templates/includes/program_menu.html b/src/program/templates/includes/program_menu.html index f83b03bb..d5439a8b 100644 --- a/src/program/templates/includes/program_menu.html +++ b/src/program/templates/includes/program_menu.html @@ -1,10 +1,12 @@ Schedule Events Speakers - {% if camp.call_for_participation_open %} - Call for Participation - {% if request.user.is_authenticated %} + Call for Participation + {% if request.user.is_authenticated %} + {% if camp.call_for_participation_open %} Submit Proposal + {% else %} + View Proposals {% endif %} {% endif %} diff --git a/src/program/templates/proposal_list.html b/src/program/templates/proposal_list.html index 564c7d55..13245d8f 100644 --- a/src/program/templates/proposal_list.html +++ b/src/program/templates/proposal_list.html @@ -6,7 +6,14 @@ Proposals | {{ block.super }} {% block program_content %} -{% include 'includes/event_proposal_type_select.html' %} +{% if camp.call_for_participation_open %} + {% include 'includes/event_proposal_type_select.html' %} +{% else %} +
+ Note! This Call for Particilation is not open. +
+{% endif %} + {% if speakerproposal_list or eventproposal_list %}
diff --git a/src/program/views.py b/src/program/views.py index 1b776543..a37a8317 100644 --- a/src/program/views.py +++ b/src/program/views.py @@ -631,8 +631,15 @@ class ScheduleView(CampViewMixin, TemplateView): class CallForParticipationView(CampViewMixin, TemplateView): - def get_template_names(self): - return '%s_call_for_participation.html' % self.camp.slug + template_name = 'call_for_participation.html' + + def get_context_data(self, *args, **kwargs): + context = super().get_context_data(**kwargs) + if self.camp.call_for_participation: + context['cfp_markdown'] = self.camp.call_for_participation + else: + context['cfp_markdown'] = "

This CFP has not been written yet.

" + return context ################################################################################################### From 24371b629a904a37696262f8c350f115f0f97a10 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Sat, 26 May 2018 10:24:52 +0200 Subject: [PATCH 17/18] reenable mails to Content team when speaker/eventproposals are created/updated, change so proposal URLs are opened in new window, add a message in browser when proposals are approved in the admin --- src/program/admin.py | 4 +- src/program/models.py | 25 ++++++++-- .../includes/event_proposal_table.html | 2 +- .../includes/eventproposalurl_table.html | 2 +- .../includes/speaker_proposal_table.html | 2 +- .../includes/speakerproposalurl_table.html | 2 +- src/program/views.py | 50 +++++++++++++++++-- 7 files changed, 74 insertions(+), 13 deletions(-) diff --git a/src/program/admin.py b/src/program/admin.py index 1686fee3..72ef2b10 100644 --- a/src/program/admin.py +++ b/src/program/admin.py @@ -24,7 +24,7 @@ from .models import ( class SpeakerProposalAdmin(admin.ModelAdmin): def mark_speakerproposal_as_approved(self, request, queryset): for sp in queryset: - sp.mark_as_approved() + sp.mark_as_approved(request) mark_speakerproposal_as_approved.description = 'Approve and create Speaker object(s)' actions = ['mark_speakerproposal_as_approved'] @@ -43,7 +43,7 @@ class EventProposalAdmin(admin.ModelAdmin): return False else: try: - ep.mark_as_approved() + ep.mark_as_approved(request) except ValidationError as e: messages.error(request, e) return False diff --git a/src/program/models.py b/src/program/models.py index 653f7a59..72fd9ad4 100644 --- a/src/program/models.py +++ b/src/program/models.py @@ -247,7 +247,7 @@ class SpeakerProposal(UserSubmittedModel): def get_absolute_url(self): return reverse_lazy('program:speakerproposal_detail', kwargs={'camp_slug': self.camp.slug, 'pk': self.uuid}) - def mark_as_approved(self): + def mark_as_approved(self, request): speakermodel = apps.get_model('program', 'speaker') speakerproposalmodel = apps.get_model('program', 'speakerproposal') speaker = speakermodel() @@ -261,6 +261,16 @@ class SpeakerProposal(UserSubmittedModel): self.proposal_status = speakerproposalmodel.PROPOSAL_APPROVED self.save() + # copy all the URLs too + for url in self.urls.all(): + Url.objects.create( + url=url.url, + urltype=url.urltype, + speaker=speaker + ) + + messages.success(request, "Speaker object %s has been created" % speaker) + class EventProposal(UserSubmittedModel): """ An event proposal """ @@ -336,11 +346,11 @@ class EventProposal(UserSubmittedModel): user=self.user ).exclude(uuid__in=self.speakers.all().values_list('uuid')) - def mark_as_approved(self): + def mark_as_approved(self, request): eventmodel = apps.get_model('program', 'event') eventproposalmodel = apps.get_model('program', 'eventproposal') event = eventmodel() - event.camp = self.camp + event.track = self.track event.title = self.title event.abstract = self.abstract event.event_type = self.event_type @@ -358,6 +368,15 @@ class EventProposal(UserSubmittedModel): self.proposal_status = eventproposalmodel.PROPOSAL_APPROVED self.save() + # copy all the URLs too + for url in self.urls.all(): + Url.objects.create( + url=url.url, + urltype=url.urltype, + event=event + ) + + messages.success(request, "Event object %s has been created" % event) ############################################################################### diff --git a/src/program/templates/includes/event_proposal_table.html b/src/program/templates/includes/event_proposal_table.html index 7bc954a0..6d872a5a 100644 --- a/src/program/templates/includes/event_proposal_table.html +++ b/src/program/templates/includes/event_proposal_table.html @@ -15,7 +15,7 @@ {{ eventproposal.title }} {{ eventproposal.event_type }} - {% for url in eventproposal.urls.all %} {% empty %}N/A{% endfor %} + {% for url in eventproposal.urls.all %} {% empty %}N/A{% endfor %} {% for person in eventproposal.speakers.all %} {% endfor %} {{ eventproposal.track.name }} {{ eventproposal.proposal_status }} diff --git a/src/program/templates/includes/eventproposalurl_table.html b/src/program/templates/includes/eventproposalurl_table.html index 5af137d2..e224038c 100644 --- a/src/program/templates/includes/eventproposalurl_table.html +++ b/src/program/templates/includes/eventproposalurl_table.html @@ -10,7 +10,7 @@ {% for url in eventproposal.urls.all %} {{ url.urltype.name }} - {{ url }} + {{ url }} {% if not camp.read_only %} Update diff --git a/src/program/templates/includes/speaker_proposal_table.html b/src/program/templates/includes/speaker_proposal_table.html index fea5d254..df4988a0 100644 --- a/src/program/templates/includes/speaker_proposal_table.html +++ b/src/program/templates/includes/speaker_proposal_table.html @@ -23,7 +23,7 @@ {% for url in speakerproposal.urls.all %} - + {% empty %} N/A {% endfor %} diff --git a/src/program/templates/includes/speakerproposalurl_table.html b/src/program/templates/includes/speakerproposalurl_table.html index 32e0dfa6..77ad2134 100644 --- a/src/program/templates/includes/speakerproposalurl_table.html +++ b/src/program/templates/includes/speakerproposalurl_table.html @@ -10,7 +10,7 @@ {% for url in speakerproposal.urls.all %} {{ url.urltype.name }} - {{ url }} + {{ url }} {% if not camp.read_only %} Update diff --git a/src/program/views.py b/src/program/views.py index a37a8317..c48235ef 100644 --- a/src/program/views.py +++ b/src/program/views.py @@ -28,6 +28,8 @@ from .mixins import ( UrlViewMixin, ) from .email import ( + add_new_eventproposal_email, + add_new_speakerproposal_email, add_speakerproposal_updated_email, add_eventproposal_updated_email ) @@ -151,6 +153,10 @@ class SpeakerProposalCreateView(LoginRequiredMixin, CampViewMixin, EnsureWritabl # add speakerproposal to eventproposal self.eventproposal.speakers.add(speakerproposal) + # send mail to content team + if not add_new_speakerproposal_email(speakerproposal): + logger.error("Unable to send email to content team after new speakerproposal") + return redirect( reverse('program:proposal_list', kwargs={'camp_slug': self.camp.slug}) ) @@ -163,8 +169,6 @@ class SpeakerProposalUpdateView(LoginRequiredMixin, CampViewMixin, EnsureWritabl model = models.SpeakerProposal template_name = 'speakerproposal_form.html' - def get_success_url(self): - return reverse('program:proposal_list', kwargs={'camp_slug': self.camp.slug}) def get_form_class(self): """ Get the appropriate form class based on the eventtype """ @@ -181,6 +185,22 @@ class SpeakerProposalUpdateView(LoginRequiredMixin, CampViewMixin, EnsureWritabl # more than one type of event for this person, return the generic speakerproposal form return BaseSpeakerProposalForm + def form_valid(self, form): + """ + Change the speakerproposal status to pending + """ + # set proposal status to pending + form.instance.proposal_status = models.SpeakerProposal.PROPOSAL_PENDING + speakerproposal = form.save() + + # send mail to content team + if not add_speakerproposal_updated_email(speakerproposal): + logger.error("Unable to send email to content team after speakerproposal update") + + # message user and redirect + messages.info(self.request, "Your proposal is now pending approval by the content team.") + return redirect(reverse('program:proposal_list', kwargs={'camp_slug': self.camp.slug})) + class SpeakerProposalDeleteView(LoginRequiredMixin, CampViewMixin, EnsureWritableCampMixin, EnsureUserOwnsProposalMixin, EnsureCFPOpenMixin, DeleteView): """ @@ -391,6 +411,10 @@ class EventProposalCreateView(LoginRequiredMixin, CampViewMixin, EnsureWritableC # add the speakerproposal to the eventproposal eventproposal.speakers.add(self.speakerproposal) + # send mail to content team + if not add_new_eventproposal_email(eventproposal): + logger.error("Unable to send email to content team after new eventproposal") + # all good return redirect(self.get_success_url()) @@ -406,8 +430,6 @@ class EventProposalUpdateView(LoginRequiredMixin, CampViewMixin, EnsureWritableC """ Get the appropriate form class based on the eventtype """ return get_eventproposal_form_class(self.get_object().event_type) - def get_success_url(self): - return reverse('program:proposal_list', kwargs={'camp_slug': self.camp.slug}) def get_context_data(self, *args, **kwargs): """ Make speakerproposal and eventtype objects available in the template """ @@ -425,6 +447,19 @@ class EventProposalUpdateView(LoginRequiredMixin, CampViewMixin, EnsureWritableC form.fields['track'].queryset = models.EventTrack.objects.filter(camp=self.camp) return form + def form_valid(self, form): + # set status to pending and save eventproposal + form.instance.proposal_status = models.EventProposal.PROPOSAL_PENDING + eventproposal = form.save() + + # send email to content team + if not add_eventproposal_updated_email(eventproposal): + logger.error("Unable to send email to content team after eventproposal update") + + # message for the user and redirect + messages.info(self.request, "Your proposal is now pending approval by the content team.") + return redirect(reverse('program:proposal_list', kwargs={'camp_slug': self.camp.slug})) + class EventProposalDeleteView(LoginRequiredMixin, CampViewMixin, EnsureWritableCampMixin, EnsureUserOwnsProposalMixin, EnsureCFPOpenMixin, DeleteView): model = models.EventProposal @@ -543,6 +578,13 @@ class CombinedProposalSubmitView(LoginRequiredMixin, CampViewMixin, CreateView): # add the speakerproposal to the eventproposal eventproposal.speakers.add(speakerproposal) + # send mail(s) to content team + if not add_new_eventproposal_email(eventproposal): + logger.error("Unable to send email to content team after new eventproposal") + if not hasattr(self, 'speakerproposal'): + if not add_new_speakerproposal_email(speakerproposal): + logger.error("Unable to send email to content team after new speakerproposal") + # all good return redirect(reverse_lazy('program:proposal_list', kwargs={'camp_slug': self.camp.slug})) From 9052526264cbb47335c5aba251ddf0d1173b66a4 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Sat, 26 May 2018 10:48:38 +0200 Subject: [PATCH 18/18] remove action buttons from proposal list, they can be found in the detail views, helps a lot with the width issues when things have long names --- .../templates/includes/event_proposal_table.html | 15 +++------------ .../includes/speaker_proposal_table.html | 13 +++---------- src/program/templates/speakerproposal_detail.html | 1 + 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/src/program/templates/includes/event_proposal_table.html b/src/program/templates/includes/event_proposal_table.html index 6d872a5a..a3b9e52d 100644 --- a/src/program/templates/includes/event_proposal_table.html +++ b/src/program/templates/includes/event_proposal_table.html @@ -20,18 +20,9 @@ {{ eventproposal.track.name }} {{ eventproposal.proposal_status }} - - Detail - {% if not camp.read_only %} - Modify - Add URL - {% if eventproposal.get_available_speakerproposals.exists %} - Add {{ eventproposal.event_type.host_title }} - {% else %} - Add {{ eventproposal.event_type.host_title }} - {% endif %} - {% endif %} + + Details + {% endfor %} diff --git a/src/program/templates/includes/speaker_proposal_table.html b/src/program/templates/includes/speaker_proposal_table.html index df4988a0..9269d28f 100644 --- a/src/program/templates/includes/speaker_proposal_table.html +++ b/src/program/templates/includes/speaker_proposal_table.html @@ -30,16 +30,9 @@ {{ speakerproposal.proposal_status }} - - Detail - {% if not camp.read_only %} - Modify - {% if eventproposal and eventproposal.speakers.count > 1 %} - Remove - {% endif %} - Add URL - {% endif %} + + Details + {% endfor %} diff --git a/src/program/templates/speakerproposal_detail.html b/src/program/templates/speakerproposal_detail.html index a8b657d5..eefe2892 100644 --- a/src/program/templates/speakerproposal_detail.html +++ b/src/program/templates/speakerproposal_detail.html @@ -34,6 +34,7 @@ {% else %} Nothing found. {% endif %} + Add New Event