Commit 4f14dfa5 authored by fred's avatar fred

performance: grid view (157 -> 12 queries)

parent 5d15164d
...@@ -210,7 +210,8 @@ class Grid(TemplateView): ...@@ -210,7 +210,8 @@ class Grid(TemplateView):
time_cell.time_label = '%02d:00-%02d:00' % ( time_cell.time_label = '%02d:00-%02d:00' % (
nonstop[0], nonstop[1]) nonstop[0], nonstop[1])
for schedule in Schedule.objects.select_related().order_by('datetime'): for schedule in Schedule.objects.prefetch_related(
'emission__categories').select_related().order_by('datetime'):
row_start = schedule.datetime.hour * 2 + \ row_start = schedule.datetime.hour * 2 + \
int(math.ceil(schedule.datetime.minute / 30)) int(math.ceil(schedule.datetime.minute / 30))
day_no = schedule.get_weekday() day_no = schedule.get_weekday()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment