django-crispy-forms / django-crispy-forms/crispy-tailwind

[bug] checkboxmultipleselect is a radio

Open
#126 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
423
Forks
64
PR merge metrics
No merged PRs in 30d

Description

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'
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.