2
0
Fork 0

reduce team shift view query count

This commit is contained in:
Andreas (@xAndy) Zimmermann 2023-05-28 12:24:31 +02:00
parent 4f4b5c3009
commit 7aa5da28fe
1 changed files with 3 additions and 1 deletions

View File

@ -93,7 +93,9 @@ def add_helper_shift(self):
@login_required @login_required
def shift_detail(request, pk): def shift_detail(request, pk):
shift = get_object_or_404(Shift, pk=pk) shift = get_object_or_404(
Shift.with_reg_count().prefetch_related("shiftregistration_set__helper"), pk=pk
)
form = HelperShift() form = HelperShift()
if request.method == "POST": if request.method == "POST":
form = HelperShift(request.POST) form = HelperShift(request.POST)