django-crispy-forms / crispy-tailwind

A Tailwind template pack for django-crispy-forms
MIT License
331 stars 56 forks source link

css_container is missing from context in widgets with custom templates e.g. CheckboxMultipleSelect #117

Open grundleborg opened 2 years ago

grundleborg commented 2 years ago

I'm not sure if there's a bug here, or if I just don't fully understand what CSSContainer is / how it is supposed to work. When rendering a widget such as CheckboxMultipleSelect which has it's own custom template which does not use the tailwind_field template tag to render the field, the CSS classes are taken from the css_container object. However, this does not appear to be present in the context, so setting the default classes in CrispyTailwindFieldNode.default_styles of tailwind_field.py has no effect. I'm not sure whether I'm expecting the wrong thing to happen here, or whether these widgets with custom templates are not even expected to work yet. Any pointers would be most welcome, as I am trying to get this and a few other widgets working properly for a project, as well as sending PRs to this repo with any fixes and/or missing functionality to arise from this.