diff --git a/shiftregister/app/views.py b/shiftregister/app/views.py index fd66db7..83be945 100644 --- a/shiftregister/app/views.py +++ b/shiftregister/app/views.py @@ -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)