add updates plugin

This commit is contained in:
krmax44 2022-03-17 16:38:47 +01:00
parent ca79e88c16
commit 03342fde2d
No known key found for this signature in database
GPG key ID: 5C499A4F4EC4EE03
6 changed files with 162 additions and 40 deletions

View file

@ -53,17 +53,12 @@ class GovPlanDetailView(GovernmentMixin, DetailView):
"responsible_publicbody", "organization"
)
def get_section(self):
return GovernmentPlanSection.objects.filter(
categories__in=self.object.categories.all()
).first()
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["updates"] = self.object.updates.filter(public=True).order_by(
"-timestamp"
)
context["section"] = self.get_section()
context["section"] = self.object.get_section()
if self.request.user.is_authenticated:
context["update_proposal_form"] = GovernmentPlanUpdateProposalForm()
# For CMS toolbar