Closed ghost closed 2 years ago
Hi @gldecurtins
Thanks for the PR.
I think this whole section could do with a rework to simplify the logic in the template.
I'm think we should use the optgroups
[1] filter from crispy-forms. I'd then expect that we can use the selected value from Django rather than trying to recalculate it in the template. Here's an example of it being used in the bootstrap4 template pack [2]
It's on my list to come back to this once I've got a the next release of crispy-forms (core) out.
In the meantime lets see what the tests say and see if we can merge this.
Merging #121 (4f8be81) into main (41d3a96) will not change coverage. The diff coverage is
100.00%
.:exclamation: Current head 4f8be81 differs from pull request most recent head 8acaf0a. Consider uploading reports for the commit 8acaf0a to get more accurate results
@@ Coverage Diff @@
## main #121 +/- ##
=======================================
Coverage 88.20% 88.20%
=======================================
Files 37 37
Lines 636 636
Branches 34 34
=======================================
Hits 561 561
Misses 66 66
Partials 9 9
Impacted Files | Coverage Δ | |
---|---|---|
...lwind/templates/tailwind/layout/select_option.html | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 41d3a96...8acaf0a. Read the comment docs.
This change will take care that integers can match characters. It will fix an issue with django-filter. I've tested this solution in my development environment. Works fine for django-filter based select fields, as well as for regular django forms.