From 0c9846db08e4f3db308b0fc055ef392018bbc649 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar <theskumar@users.noreply.github.com> Date: Sat, 23 Jul 2022 22:45:36 +0530 Subject: [PATCH] =?UTF-8?q?Fix=20=E2=80=9CFilteredFieldPanel=E2=80=9D=20fo?= =?UTF-8?q?r=20wagtail=203.x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hypha/apply/funds/edit_handlers.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hypha/apply/funds/edit_handlers.py b/hypha/apply/funds/edit_handlers.py index 6cc01cd08..e312e2dad 100644 --- a/hypha/apply/funds/edit_handlers.py +++ b/hypha/apply/funds/edit_handlers.py @@ -113,7 +113,10 @@ class FilteredFieldPanel(FieldPanel): filter_query=self.filter_query, ) - def on_form_bound(self): - super().on_form_bound() - target_model = self.bound_field.field.queryset.model - self.bound_field.field.queryset = target_model.objects.filter(**self.filter_query) + class BoundPanel(FieldPanel.BoundPanel): + def __init__(self, **kwargs): + super().__init__(**kwargs) + target_model = self.bound_field.field.queryset.model + self.bound_field.field.queryset = target_model.objects.filter( + **self.panel.filter_query + ) -- GitLab