From 30a0e63eb9b450097c8ed343157813ecfba4393b Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sun, 4 Apr 2021 17:18:50 +0200 Subject: [PATCH] Fix solution view --- apps/registration/views.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/registration/views.py b/apps/registration/views.py index bab5fc1..f63a5a3 100644 --- a/apps/registration/views.py +++ b/apps/registration/views.py @@ -541,11 +541,14 @@ class SolutionView(LoginRequiredMixin, View): raise Http404 solution = Solution.objects.get(file__endswith=filename) user = request.user - passage_participant_qs = Passage.objects.filter(Q(defender=user.registration.team.participation) - | Q(opponent=user.registration.team.participation) - | Q(reporter=user.registration.team.participation), - defender=solution.participation, - solution_number=solution.problem) + if user.registration.participates: + passage_participant_qs = Passage.objects.filter(Q(defender=user.registration.team.participation) + | Q(opponent=user.registration.team.participation) + | Q(reporter=user.registration.team.participation), + defender=solution.participation, + solution_number=solution.problem) + else: + passage_participant_qs = Passage.objects.none() if not (user.registration.is_admin or user.registration.is_volunteer and Passage.objects.filter(Q(pool__juries=user.registration) | Q(pool__tournament__in=user.registration.organized_tournaments.all()),