Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Feb 25, 2024

Conversation

jplaverdure
Copy link
Contributor

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.

…puts when show_form_labels is False (#1)

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
Copy link
Contributor Author

jplaverdure commented Jan 11, 2024

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

Removes extraneous <div> tags from testing template
@jplaverdure
Copy link
Contributor Author

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

@jplaverdure
Copy link
Contributor Author

Hello, any news on integrating this fix ?
Thanks.

@smithdc1
Copy link
Member

smithdc1 commented Feb 2, 2024

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
Copy link
Contributor Author

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
Copy link
Member

Thanks @jplaverdure! This looks good to me. 👍

@smithdc1 smithdc1 merged commit ef3f3da into django-crispy-forms:main Feb 25, 2024
5 checks passed
@jplaverdure
Copy link
Contributor Author

jplaverdure commented Feb 26, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants