feat(checkin): prefetch related objects of ShiftRegistration
This commit is contained in:
parent
c50bb0ec78
commit
97335e72bb
|
@ -289,10 +289,12 @@ class CheckinList(LoginRequiredMixin, ListView):
|
||||||
title = "Ankommende Helfer:innen"
|
title = "Ankommende Helfer:innen"
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return ShiftRegistration.objects.filter(
|
return (
|
||||||
shift__deleted=False,
|
ShiftRegistration.objects.select_related("helper", "shift")
|
||||||
state=ShiftRegistration.RegState.REGISTERED,
|
.prefetch_related("shift__event__calendar")
|
||||||
).order_by("shift__start_at")[:30]
|
.filter(shift__deleted=False, state=ShiftRegistration.RegState.REGISTERED)
|
||||||
|
.order_by("shift__start_at")[:30]
|
||||||
|
)
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
|
|
Loading…
Reference in New Issue