From 5b2e45eb59e8c3eb8689a54c437bca687498b5b4 Mon Sep 17 00:00:00 2001 From: Horilla Date: Mon, 28 Apr 2025 14:30:16 +0530 Subject: [PATCH] [FIX] HORILLA VIEWS: Toggle column select all unselect script not working issue --- horilla_views/forms.py | 11 +++++++++-- horilla_views/templates/generic/as_list.html | 14 +++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/horilla_views/forms.py b/horilla_views/forms.py index d09eee8de..ad994f5a7 100644 --- a/horilla_views/forms.py +++ b/horilla_views/forms.py @@ -29,7 +29,14 @@ class ToggleColumnForm(forms.Form): Toggle column form """ - def __init__(self, columns, default_columns, hidden_fields: list, *args, **kwargs): + def __init__( + self, + columns, + default_columns, + hidden_fields: list, + *args, + **kwargs, + ): request = getattr(_thread_locals, "request", {}) self.request = request super().__init__(*args, **kwargs) @@ -38,7 +45,7 @@ class ToggleColumnForm(forms.Form): if column[1] in hidden_fields: initial = False if not hidden_fields: - if column not in default_columns: + if default_columns and column not in default_columns: initial = False self.fields[column[1]] = forms.BooleanField( label=column[0], initial=initial diff --git a/horilla_views/templates/generic/as_list.html b/horilla_views/templates/generic/as_list.html index d703cf509..83503d55d 100644 --- a/horilla_views/templates/generic/as_list.html +++ b/horilla_views/templates/generic/as_list.html @@ -3,10 +3,18 @@ - +