Skip to content

[bug] checkboxmultipleselect is a radio #126

@rosscdh

Description

@rosscdh

as per https://github.com/django/django/blob/main/django/forms/widgets.py#L839

unfortunately the widget inherits from radioselect which means that isinstance will return true an show a radio select due to the order in https://github.com/django-crispy-forms/crispy-tailwind/blob/main/crispy_tailwind/templates/tailwind/field.html#L20

as is demonstrated here

(Pdb) isinstance(form.fields.get('infrastructure').widget, forms.CheckboxSelectMultiple)
True
(Pdb) isinstance(form.fields.get('infrastructure').widget, forms.RadioSelect)
True

a working fix would be to test for the class name rather?

 form.fields.get('infrastructure').widget.__class__.__name__
'CheckboxSelectMultiple'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions