django-crispy-forms / crispy-bootstrap4

Bootstrap 4 template pack for django-crispy-forms
MIT License
11 stars 5 forks source link

Update field.html to enable the use of custom-controls on checkbox inputs when show_form_labels is False #25

Closed jplaverdure closed 8 months ago

jplaverdure commented 10 months ago

The current code prevents the display of checkboxes (single) as BS4 custom-controls if show_form_labels is False. This modification moves the control of the label display around the label block itself allowing the display of checkboxes as custom-control regardless of the value of show_form_labels.

jplaverdure commented 10 months ago

Hello, I updated the associated test file to support the modification I'm proposing.

jplaverdure commented 9 months ago

Now fully tested on my end prior to updating the PR, all tests pass.
Sorry about that.

jplaverdure commented 9 months ago

Hello, any news on integrating this fix ? Thanks.

smithdc1 commented 9 months ago

Hello, I updated the associated test file to support the modification I'm proposing.

Testing this file I can't see any difference with this PR. Both look like this for me 🤔

image

jplaverdure commented 9 months ago

OMG ! And here I was thinking this would be a simple fix to get the custom-checkbox to work inside tables. Turns out a bit more work was required for it to work correctly. I based my final solution off of: https://stackoverflow.com/questions/54865038/style-a-bootstrap-4-checkbox-without-label

Works OK for me now, my table inline-formset now display custom-checkboxes and rregular (non tables-based) custom checkboxes also work and display as intended. Please review

smithdc1 commented 8 months ago

Thanks @jplaverdure! This looks good to me. 👍

jplaverdure commented 8 months ago

@smithdc1 Any way we can get this into a release on pypi, please ? This would simplify my project dependencies' management !