Crispy Tailwind rendering Checkbox Multiple as Radios

Hey all

Back here after 10 years away from the Django Community, good to be back going again.

Has anyone had any issues with Crispy Tailwind and outputting multi checkboxes?

When I’m outputting my form, I’m getting radios rather than checkboxes.

Form looks like this:

class SignUpForm(forms.ModelForm):

    activities = forms.ModelMultipleChoiceField(
        widget=forms.CheckboxSelectMultiple,
        queryset=Activity.objects.all(),   
    )

    class Meta:
        model = Supplier
        fields = ['activities'] 

HTML

{% extends "base.html" %}
{% load crispy_forms_tags %}
{% load tailwind_filters %}


{% block content %}
<h1 class="text-2xl text-blue-500">Sign Up</h1>
<form method="POST" class="max-w-lg mx-auto">
    {% csrf_token %}
    {{ form|crispy }}   
    <button type="submit">
        Submit
    </button>
</form>
{% endblock %}

For some background information:

  • What versions of Django, Crispy Forms, and Python are you using?

  • What specific version of the crispy-tailwind template pack are you using? (The last release posted on pypi was April '21, while the current version on github shows a last update of May '22. If you’re only using the released version, you might want to try the github version.)

  • Have you verified that the html being rendered is actually radio buttons and not checkboxes rendered as round buttons?

  • Have you tried rendering the form as {% crispy form %} instead of using the filter? (If so, what were the results?)

Thanks for the reply Ken

I’ve eventually managed to get it working after switching to the github version.

For anyone else searching for an answer in the future.

I’d previously tried different both the crispy form declaration and the filter declaration and both produce the same result.

Versions:

Python 3.11.3
Django: 4.1.8
Crispy Forms: 2.0
Crispy Tailwind: 0.5.0

Following Ken’s advice:

pip uninstall crispy-tailwind

[Create dependencies directory and change in to this directory]

git clone https://github.com/django-crispy-forms/crispy-tailwind.git

pip install -e .

Add dependencies directory to requirements.txt
pip install -r requirements.txt