From 515eb57d51b1ac51834c029d0a8a186b6faf8b10 Mon Sep 17 00:00:00 2001 From: Mahrez Benhamad Date: Wed, 18 Sep 2024 16:39:48 +0100 Subject: [PATCH] update forms.py file to handle pointer attrs --- crispy_forms_foundation/forms.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crispy_forms_foundation/forms.py b/crispy_forms_foundation/forms.py index 603be90..ed64920 100644 --- a/crispy_forms_foundation/forms.py +++ b/crispy_forms_foundation/forms.py @@ -107,12 +107,12 @@ def init_helper(self): # Get a list of all fields with their location within the layout layout_field_names = self.helper.layout.get_field_names() # Transform checkbox fields to switches element + for pointer in layout_field_names: - if isinstance(self.fields[pointer[1]].widget, + if isinstance(self.fields[pointer.name].widget, forms.CheckboxInput): - field = InlineSwitchField(pointer[1], - switch_class="inline") - self.replace_layout_object(pointer[0], field) + field = InlineSwitchField(pointer.name,switch_class="inline") + self.replace_layout_object(pointer.positions, field) if self.submit: if isinstance(self.submit, Submit):