diff --git a/froide_govplan/models.py b/froide_govplan/models.py index bafe900..2eedc91 100644 --- a/froide_govplan/models.py +++ b/froide_govplan/models.py @@ -354,6 +354,15 @@ class GovernmentPlanSection(models.Model): def get_absolute_domain_url(self): return settings.SITE_URL + self.get_absolute_url() + def get_plans(self): + return ( + GovernmentPlan.objects.filter( + categories__in=self.categories.all(), government=self.government + ) + .distinct() + .order_by("title") + ) + if CMSPlugin: diff --git a/froide_govplan/templates/froide_govplan/plugins/sections.html b/froide_govplan/templates/froide_govplan/plugins/sections.html index f1cfc02..3864174 100644 --- a/froide_govplan/templates/froide_govplan/plugins/sections.html +++ b/froide_govplan/templates/froide_govplan/plugins/sections.html @@ -1,4 +1,5 @@ {% load thumbnail %} +{% load govplan %}