diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-04-14 16:48:14 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-04-14 16:48:14 (GMT) |
commit | 179a462bf561dc0cb4d19133e7e3684055278296 (patch) | |
tree | f2aaf3e4bbf132fa3d0fbbbafca88a420f8225a7 | |
parent | f961c63ad70549b1818942ba757184d4d608b2c4 (diff) |
easier to understand export format for day_schedule
-rw-r--r-- | program/views.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/program/views.py b/program/views.py index c8796c6..29253c0 100644 --- a/program/views.py +++ b/program/views.py @@ -198,11 +198,12 @@ def json_day_schedule(request, year=None, month=None, day=None): timeslots = TimeSlot.objects.get_24h_timeslots(today) schedule = [] for ts in timeslots: + entry = { 'start': ts.start.strftime('%H:%M:%S'), 'title': ts.programslot.show.name, 'id': -1 } if ts.programslot.automation_id: - schedule.append((ts.start.strftime('%H:%M:%S'), ts.programslot.show.name, ts.programslot.automation_id)) + entry['id'] = ts.programslot.automation_id elif ts.programslot.show.automation_id: - schedule.append((ts.start.strftime('%H:%M:%S'), ts.programslot.show.name, ts.programslot.show.automation_id)) - else: - schedule.append((ts.start.strftime('%H:%M:%S'), ts.programslot.show.name, -1)) + entry['id'] = ts.programslot.show.automation_id + + schedule.append(entry) return HttpResponse(json.dumps(schedule, ensure_ascii=False, encoding='utf8').encode('utf8'), content_type="application/json; charset=utf-8") |