Merge pull request #62 from lca2017/chrisjrn/20161210
Adds “exclusive” field to slots,
This commit is contained in:
commit
cc05d09f26
5 changed files with 46 additions and 4 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'),
|
||||||
|
),
|
||||||
|
]
|
16
symposion/schedule/migrations/0004_merge.py
Normal file
16
symposion/schedule/migrations/0004_merge.py
Normal file
|
@ -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 = [
|
||||||
|
]
|
|
@ -87,6 +87,11 @@ class Slot(models.Model):
|
||||||
kind = models.ForeignKey(SlotKind, verbose_name=_("Kind"))
|
kind = models.ForeignKey(SlotKind, verbose_name=_("Kind"))
|
||||||
start = models.TimeField(verbose_name=_("Start"))
|
start = models.TimeField(verbose_name=_("Start"))
|
||||||
end = models.TimeField(verbose_name=_("End"))
|
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 = models.TextField(blank=True, verbose_name=_("Content override"))
|
||||||
content_override_html = models.TextField(blank=True)
|
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.annotate(room_count=Count("slotroom"), order=Min("slotroom__room__order"))
|
||||||
slots = slots.order_by("start", "order")
|
slots = slots.order_by("start", "order")
|
||||||
row = []
|
row = []
|
||||||
|
total_room_count = self.rooms().count()
|
||||||
for time, next_time in pairwise(times):
|
for time, next_time in pairwise(times):
|
||||||
row = {"time": time, "slots": []}
|
row = {"time": time, "slots": []}
|
||||||
for slot in slots:
|
for slot in slots:
|
||||||
if slot.start == time:
|
if slot.start == time:
|
||||||
slot.rowspan = TimeTable.rowspan(times, slot.start, slot.end)
|
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)
|
row["slots"].append(slot)
|
||||||
if row["slots"] or next_time is None:
|
if row["slots"] or next_time is None:
|
||||||
yield row
|
yield row
|
||||||
|
|
|
@ -228,7 +228,7 @@ def schedule_json(request):
|
||||||
"contact": [],
|
"contact": [],
|
||||||
}
|
}
|
||||||
if hasattr(slot.content, "proposal"):
|
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
|
continue
|
||||||
|
|
||||||
slot_data.update({
|
slot_data.update({
|
||||||
|
@ -237,7 +237,7 @@ def schedule_json(request):
|
||||||
"contact": [
|
"contact": [
|
||||||
s.email for s in slot.content.speakers()
|
s.email for s in slot.content.speakers()
|
||||||
] if request.user.is_staff else ["redacted"],
|
] if request.user.is_staff else ["redacted"],
|
||||||
"abstract": slot.content.abstract.raw,
|
"abstract": slot.content.abstract,
|
||||||
"conf_url": "%s://%s%s" % (
|
"conf_url": "%s://%s%s" % (
|
||||||
protocol,
|
protocol,
|
||||||
Site.objects.get_current().domain,
|
Site.objects.get_current().domain,
|
||||||
|
@ -247,7 +247,7 @@ def schedule_json(request):
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
slot_data.update({
|
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)
|
data.append(slot_data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue