Fix visibility of non-public plans in section list

This commit is contained in:
Stefan Wehrmeyer 2022-06-20 11:18:38 +02:00
parent 07d562f2d8
commit 5e43d627d7
4 changed files with 25 additions and 21 deletions

View file

@ -4,6 +4,7 @@ from django.shortcuts import get_object_or_404, redirect, render
from django.utils.translation import gettext_lazy as _
from django.views.generic import DetailView, UpdateView
from .auth import get_allowed_plans
from .forms import GovernmentPlanUpdateProposalForm
from .models import Government, GovernmentPlan, GovernmentPlanSection
@ -33,7 +34,8 @@ class GovPlanSectionDetailView(GovernmentMixin, DetailView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["plans"] = context["object"].get_plans()
queryset = get_allowed_plans(self.request)
context["plans"] = context["object"].get_plans(queryset=queryset)
return context