Skip to content
Snippets Groups Projects
Commit 86725d5f authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

Optimize selection of time slot by fetching the program slots

parent 9dee37ef
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,7 @@ class HostDetailView(DetailView): ...@@ -27,7 +27,7 @@ class HostDetailView(DetailView):
class ShowListView(ListView): class ShowListView(ListView):
context_object_name = 'show_list' context_object_name = 'show_list'
queryset = Show.objects.filter(is_active=True).exclude(id=1).distinct() queryset = Show.objects.filter(is_active=True).exclude(id=1)
template_name = 'show_list.html' template_name = 'show_list.html'
def get_queryset(self): def get_queryset(self):
...@@ -50,7 +50,7 @@ class ShowListView(ListView): ...@@ -50,7 +50,7 @@ class ShowListView(ListView):
class ShowDetailView(DetailView): class ShowDetailView(DetailView):
queryset = Show.objects.all().exclude(id=1) queryset = Show.objects.exclude(id=1)
template_name = 'show_detail.html' template_name = 'show_detail.html'
...@@ -195,7 +195,7 @@ def json_day_schedule(request, year=None, month=None, day=None): ...@@ -195,7 +195,7 @@ def json_day_schedule(request, year=None, month=None, day=None):
else: else:
today = datetime.strptime('%s__%s__%s__00__00' % (year, month, day), '%Y__%m__%d__%H__%M') today = datetime.strptime('%s__%s__%s__00__00' % (year, month, day), '%Y__%m__%d__%H__%M')
timeslots = TimeSlot.objects.get_24h_timeslots(today) timeslots = TimeSlot.objects.get_24h_timeslots(today).select_related('programslot')
schedule = [] schedule = []
for ts in timeslots: for ts in timeslots:
entry = { entry = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment