The best way to have DRY Django forms. The app provides a tag and filter that lets you quickly render forms in a div format while providing an enormous amount of capability to configure and control the rendered HTML.
changing the CRISPY_TEMPLATE_PACK from bootstrap5 to tailwind to bulma changes the output.
For example:
When set to CRISPY_TEMPLATE_PACK='bootstrap5' the HTML looks like:
It seems like what the CRISPY_TEMPLATE_PACK is set to should not affect the render of the form since the template pack is manually set in the template.
Description:
The docs say you can manually set a template pack on a specific form (here) with this syntax:
{{ myform|crispy:"bootstrap4" }}
However, it only seems to generate the correct HTML for the template pack that is set with the
CRISPY_TEMPLATE_PACK
.For example:
bootstrap5
,tailwind
, andbulma
CRISPY_ALLOWED_TEMPLATE_PACKS = ("bootstrap5", "tailwind", "bulma") CRISPY_TEMPLATE_PACK = "bootstrap5"
Render it 3 times with each template pack:
changing the
CRISPY_TEMPLATE_PACK
frombootstrap5
totailwind
tobulma
changes the output. For example: When set toCRISPY_TEMPLATE_PACK='bootstrap5'
the HTML looks like:But when the
CRISPY_TEMPLATE_PACK='tailwind
the HTML looks like:It seems like what the
CRISPY_TEMPLATE_PACK
is set to should not affect the render of the form since the template pack is manually set in the template.For reference here is a minimal django project replicating this issue with the above code: https://github.com/jsolum/crispy-form-testing