From 4838adf7758c5eee1e6157aea3c0a9561975f0ff Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Sat, 10 Dec 2016 08:30:44 +1100 Subject: [PATCH 1/3] =?UTF-8?q?Adds=20=E2=80=9Cexclusive=E2=80=9D=20field?= =?UTF-8?q?=20to=20slots,=20so=20that=20you=20don=E2=80=99t=20need=20to=20?= =?UTF-8?q?add=20every=20single=20room=20to=20exclusive=20events=20(like?= =?UTF-8?q?=20keynotes)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0003_slot_exclusive.py | 20 +++++++++++++++++++ symposion/schedule/models.py | 5 +++++ symposion/schedule/timetable.py | 3 ++- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 symposion/schedule/migrations/0003_slot_exclusive.py diff --git a/symposion/schedule/migrations/0003_slot_exclusive.py b/symposion/schedule/migrations/0003_slot_exclusive.py new file mode 100644 index 00000000..9fc0d847 --- /dev/null +++ b/symposion/schedule/migrations/0003_slot_exclusive.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-12-09 20:53 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('symposion_schedule', '0002_presentation_unpublish'), + ] + + operations = [ + migrations.AddField( + model_name='slot', + name='exclusive', + field=models.BooleanField(default=False, help_text='Set to true if this is the only event during this timeslot'), + ), + ] diff --git a/symposion/schedule/models.py b/symposion/schedule/models.py index 9f6a170c..dd54bc83 100644 --- a/symposion/schedule/models.py +++ b/symposion/schedule/models.py @@ -87,6 +87,11 @@ class Slot(models.Model): kind = models.ForeignKey(SlotKind, verbose_name=_("Kind")) start = models.TimeField(verbose_name=_("Start")) end = models.TimeField(verbose_name=_("End")) + exclusive = models.BooleanField( + default=False, + help_text=_("Set to true if this is the only event during this " + "timeslot"), + ) content_override = models.TextField(blank=True, verbose_name=_("Content override")) content_override_html = models.TextField(blank=True) diff --git a/symposion/schedule/timetable.py b/symposion/schedule/timetable.py index cc77a7d8..d5f422b0 100644 --- a/symposion/schedule/timetable.py +++ b/symposion/schedule/timetable.py @@ -30,12 +30,13 @@ class TimeTable(object): slots = slots.annotate(room_count=Count("slotroom"), order=Min("slotroom__room__order")) slots = slots.order_by("start", "order") row = [] + total_room_count = self.rooms().count() for time, next_time in pairwise(times): row = {"time": time, "slots": []} for slot in slots: if slot.start == time: slot.rowspan = TimeTable.rowspan(times, slot.start, slot.end) - slot.colspan = slot.room_count + slot.colspan = slot.room_count if not slot.exclusive else total_room_count row["slots"].append(slot) if row["slots"] or next_time is None: yield row From 5e372be5f6ba970a7ec67bd9b1805f1ff78967a9 Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Sat, 10 Dec 2016 14:48:30 +1100 Subject: [PATCH 2/3] Fixes issue with conference.json view --- symposion/schedule/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/symposion/schedule/views.py b/symposion/schedule/views.py index 08a50cbb..2cc7fa8a 100644 --- a/symposion/schedule/views.py +++ b/symposion/schedule/views.py @@ -228,7 +228,7 @@ def schedule_json(request): "contact": [], } if hasattr(slot.content, "proposal"): - if slot.content.proposal.unpublish and not request.user.is_staff: + if slot.content.unpublish and not request.user.is_staff: continue slot_data.update({ @@ -237,7 +237,7 @@ def schedule_json(request): "contact": [ s.email for s in slot.content.speakers() ] if request.user.is_staff else ["redacted"], - "abstract": slot.content.abstract.raw, + "abstract": slot.content.abstract, "conf_url": "%s://%s%s" % ( protocol, Site.objects.get_current().domain, @@ -247,7 +247,7 @@ def schedule_json(request): }) else: slot_data.update({ - "name": slot.content_override.raw if slot.content_override else "Slot", + "name": slot.content_override if slot.content_override else "Slot", }) data.append(slot_data) From de38ffac9e5450935c5849004821defa1d9150c2 Mon Sep 17 00:00:00 2001 From: Scott Bragg Date: Sat, 10 Dec 2016 17:07:38 +1100 Subject: [PATCH 3/3] Needs an additional migration to merge two 0003 migrations in schedule. --- symposion/schedule/migrations/0004_merge.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 symposion/schedule/migrations/0004_merge.py diff --git a/symposion/schedule/migrations/0004_merge.py b/symposion/schedule/migrations/0004_merge.py new file mode 100644 index 00000000..b89bc7cd --- /dev/null +++ b/symposion/schedule/migrations/0004_merge.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-12-10 06:05 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('symposion_schedule', '0003_slot_exclusive'), + ('symposion_schedule', '0003_auto_20161113_1530'), + ] + + operations = [ + ]