summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2013-11-05 23:06:30 (GMT)
committerErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2013-11-05 23:06:30 (GMT)
commita9e243c93c09be3800a4a1cde0c1a488bfcf3047 (patch)
treeb329814ec277d539c7f11bd9fd2f397d7e867878
parent57cbdfa46ec6afdd821923e95f60bdb8449c67b5 (diff)
Corrected mistakes made before in now playing.
-rw-r--r--nop/views.py14
1 files changed, 10 insertions, 4 deletions
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():