From a9e243c93c09be3800a4a1cde0c1a488bfcf3047 Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Wed, 6 Nov 2013 00:06:30 +0100 Subject: Corrected mistakes made before in now playing. diff --git a/nop/views.py b/nop/views.py index dbd7352..9d71379 100644 --- a/nop/views.py +++ b/nop/views.py @@ -5,7 +5,7 @@ from django.shortcuts import render_to_response from django.http import HttpResponse from django import forms from models import Master, Standby, State -from program.models import TimeSlot +from program.models import TimeSlot, Note import json import time @@ -62,12 +62,18 @@ def _get_show(datetime=None): timeslot = TimeSlot.objects.get(start__lte=datetime, end__gt=datetime) else: timeslot = TimeSlot.objects.get_or_create_current() + except (ObjectDoesNotExist, MultipleObjectsReturned): + return {'start': None, 'id': None, 'name': None} + else: + try: + note = timeslot.note + except ObjectDoesNotExist: + note = None + return {'start': _dtstring(timeslot.start.timetuple()), 'id': timeslot.show.id, 'name': timeslot.show.name, - 'note': timeslot.note} - except (ObjectDoesNotExist, MultipleObjectsReturned): - return {'start': None, 'id': None, 'name': None} + 'note': note} def _current(): -- cgit v0.10.2