Force 'my_future_shifts' query and reformat code

pull/1/head
Luca 3 years ago
parent 6d2d70e0d5
commit e7029e4002

@ -25,7 +25,7 @@ def index(request):
}
if request.helper:
context["my_future_shifts"] = (
context["my_future_shifts"] = list(
reg.shift
for reg in request.helper.shiftregistration_set.filter(
shift__start_at__gt=timezone.now(),
@ -58,9 +58,14 @@ def index(request):
for day in Shift.objects.datetimes("start_at", "day")
)
if request.helper:
free_shifts = (day.filter(~Q(shiftregistration__helper=request.helper)) for day in free_shifts)
free_shifts = (
day.filter(~Q(shiftregistration__helper=request.helper))
for day in free_shifts
)
context["free_shifts"] = list(map(lambda qs: list(qs), filter(lambda qs: qs.exists(), free_shifts)))
context["free_shifts"] = list(
map(lambda qs: list(qs), filter(lambda qs: qs.exists(), free_shifts))
)
return render(request, "shiftlist.html", context)

Loading…
Cancel
Save