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

Problems with django-smart-select

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

Description

Additional `class=chained-fk` and `data-*` attributes from the widget `ChainedSelect` (https://github.com/jazzband/django-smart-selects/blob/master/smart_selects/widgets.py#L54) does not render. They're needed attributes so `bindfields.js` would work properly.

Tried @Thutmose3's branch (https://github.com/django-crispy-forms/crispy-tailwind/pull/163) as well, with no luck.

---

**Here's what I understand so far:**
1. ChainedSelect widget generates attributes (class=chained-fk, and some data-attributes) that's later picked-up by the jQuery functions of django-smart-select.
2. Widget attributes for some reason does not render in the template when using django-crispy-forms + tailwind.
3. Found out that attributes are generated differently on ``: `field|build_attrs` vs `{% include "tailwind/layout/attrs.html" ... %}`.
4. Replaced `tailwind/layout/select.html` so that it uses Django's original template (plus some modifications so that variables match), and additional attributes are still not rendering.

Where could the attributes from `ChainedSelect` have gone?

cc: @RJAA-25

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.