fix noscript schedule template, while here add a prefetch_related in the view to reduce number of sql lookups from 116 to 8 for bootstrap data
This commit is contained in:
parent
76fcfd7855
commit
27f3470f92
|
@ -29,7 +29,7 @@
|
||||||
<td>{{ instance.when.lower|date:"H:i" }}-{{ instance.when.upper|date:"H:i" }}</td>
|
<td>{{ instance.when.lower|date:"H:i" }}-{{ instance.when.upper|date:"H:i" }}</td>
|
||||||
<td>
|
<td>
|
||||||
<i class="fas fa-video{% if not instance.event.video_recording %}-slash{% endif %}"></i>
|
<i class="fas fa-video{% if not instance.event.video_recording %}-slash{% endif %}"></i>
|
||||||
<a href="{% url 'program:event_detail' camp_slug=camp.slug slug=instance.event.slug %}">{{ instance.event.title }}</a>
|
<a href="{% url 'program:event_detail' camp_slug=camp.slug event_slug=instance.event.slug %}">{{ instance.event.title }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ instance.location.name }}</td>
|
<td>{{ instance.location.name }}</td>
|
||||||
<td>{{ instance.event.event_type }}</td>
|
<td>{{ instance.event.event_type }}</td>
|
||||||
|
|
|
@ -803,9 +803,11 @@ class NoScriptScheduleView(CampViewMixin, TemplateView):
|
||||||
|
|
||||||
def get_context_data(self, *args, **kwargs):
|
def get_context_data(self, *args, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context["eventinstances"] = models.EventInstance.objects.filter(
|
context["eventinstances"] = (
|
||||||
event__track__camp=self.camp
|
models.EventInstance.objects.filter(event__track__camp=self.camp)
|
||||||
).order_by("when")
|
.prefetch_related("location", "event__event_type")
|
||||||
|
.order_by("when")
|
||||||
|
)
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue