Adds “exclusive” field to slots, so that you don’t need to add every single room to exclusive events (like keynotes)
This commit is contained in:
parent
b4356a1551
commit
4838adf775
3 changed files with 27 additions and 1 deletions
20
symposion/schedule/migrations/0003_slot_exclusive.py
Normal file
20
symposion/schedule/migrations/0003_slot_exclusive.py
Normal file
|
@ -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'),
|
||||
),
|
||||
]
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue