From a6f0eea9b8cf6e788c0a6c72440e67bae5bd9657 Mon Sep 17 00:00:00 2001 From: "ross.crawford" Date: Thu, 8 Sep 2022 13:54:39 +0200 Subject: [PATCH] fix isinstance issues and mro --- crispy_tailwind/templatetags/tailwind_field.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crispy_tailwind/templatetags/tailwind_field.py b/crispy_tailwind/templatetags/tailwind_field.py index ee75647..f25c38b 100644 --- a/crispy_tailwind/templatetags/tailwind_field.py +++ b/crispy_tailwind/templatetags/tailwind_field.py @@ -16,42 +16,42 @@ @register.filter def is_checkbox(field): - return isinstance(field.field.widget, forms.CheckboxInput) + return field.field.widget.__class__.__name__ == forms.CheckboxInput.__class__.__name__ @register.filter def is_password(field): - return isinstance(field.field.widget, forms.PasswordInput) + return field.field.widget.__class__.__name__ == forms.PasswordInput.__class__.__name__ @register.filter def is_radioselect(field): - return isinstance(field.field.widget, forms.RadioSelect) + return field.field.widget.__class__.__name__ == forms.RadioSelect.__class__.__name__ @register.filter def is_select(field): - return isinstance(field.field.widget, forms.Select) + return field.field.widget.__class__.__name__ == forms.Select.__class__.__name__ @register.filter def is_checkboxselectmultiple(field): - return isinstance(field.field.widget, forms.CheckboxSelectMultiple) + return field.field.widget.__class__.__name__ == forms.CheckboxSelectMultiple.__class__.__name__ @register.filter def is_file(field): - return isinstance(field.field.widget, forms.FileInput) + return field.field.widget.__class__.__name__ == forms.FileInput.__class__.__name__ @register.filter def is_clearable_file(field): - return isinstance(field.field.widget, forms.ClearableFileInput) + return field.field.widget.__class__.__name__ == forms.ClearableFileInput.__class__.__name__ @register.filter def is_multivalue(field): - return isinstance(field.field.widget, forms.MultiWidget) + return field.field.widget.__class__.__name__ == forms.MultiWidget.__class__.__name__ @register.filter