Add track to schedule JSON
Include the track of the slow in the schedule JSON so the miniconf can be identified.
This commit is contained in:
parent
ae33da0de4
commit
135c5d2da3
1 changed files with 13 additions and 3 deletions
16
vendor/symposion/schedule/views.py
vendored
16
vendor/symposion/schedule/views.py
vendored
|
@ -215,14 +215,17 @@ def schedule_json(request):
|
|||
protocol = request.META.get('HTTP_X_FORWARDED_PROTO', 'http')
|
||||
data = []
|
||||
for slot in slots:
|
||||
rooms = list(slot.rooms)
|
||||
slot_data = {
|
||||
"room": ", ".join(room["name"] for room in slot.rooms.values()),
|
||||
"rooms": [room["name"] for room in slot.rooms.values()],
|
||||
"room": ", ".join(room.name for room in rooms),
|
||||
"rooms": [room.name for room in rooms],
|
||||
"start": slot.start_datetime.isoformat(),
|
||||
"end": slot.end_datetime.isoformat(),
|
||||
"duration": slot.length_in_minutes,
|
||||
"kind": slot.kind.label,
|
||||
"section": slot.day.schedule.section.slug,
|
||||
"section_name": slot.day.schedule.section.name,
|
||||
"track": None,
|
||||
"conf_key": slot.pk,
|
||||
# TODO: models should be changed.
|
||||
# these are model features from other conferences that have forked symposion
|
||||
|
@ -237,6 +240,12 @@ def schedule_json(request):
|
|||
if slot.content.unpublish and not request.user.is_staff:
|
||||
continue
|
||||
|
||||
track_name = None
|
||||
if len(rooms) == 1:
|
||||
track = rooms[0].track_set.filter(day=slot.day).first()
|
||||
if track:
|
||||
track_name = track.name
|
||||
|
||||
slot_data.update({
|
||||
"name": slot.content.title,
|
||||
"authors": [s.name for s in slot.content.speakers()],
|
||||
|
@ -250,7 +259,8 @@ def schedule_json(request):
|
|||
reverse("schedule_presentation_detail", args=[slot.content.pk])
|
||||
),
|
||||
"cancelled": slot.content.cancelled,
|
||||
"released": slot.content.proposal.recording_release
|
||||
"released": slot.content.proposal.recording_release,
|
||||
"track": track_name,
|
||||
})
|
||||
if not slot.content.speaker.twitter_username == '':
|
||||
slot_data["twitter_id"] = slot.content.speaker.twitter_username
|
||||
|
|
Loading…
Reference in a new issue