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
Incorrect rendering of form with radio buttons #126
Comments
I also noticed this same problem with the radios rendering horizontally instead of vertically by default. The rendering works as expected in 0.0.6 but changed to horizontal in 0.0.7. Looking at the rendered markup, the |
Yip, noticed just that and was driving me nuts. Please fix! |
I forked the repo and fixed this long time ago. However since nobody replied to this issue, until recently, I just assumed that nobody else cared or that the current behavior was intentionally. I've done a pull request #145 for this together with a fix for the submit button styling (should have btn-primary). We'll let the maintainers decide if the fix should be included or not. Meanwhile if you want to try it out you can get the fork from This branch is up to date with the latest master & also has the 2 fixes mentioned above. |
Thank you very much Sir. Much appreciated. |
Does aabd551 fix this for you? |
Closing this issue because the original poster does not seem to respond. |
I tried to create a simple form with 2 radio buttons and the buttons are rendered side by side horizontally. Would have expected that the radio buttons would be vertically stacked by default (as this is the bootstrap 4 default according to docs, see url below).
view/form:
template index.html:
result:
expected result:
The form part of the generated HTML looks something like this:
Looking at the bootstrap 4 documentation it looks like each radio button should be placed inside a div with the class
form-check
to get the default stacked layout.Furthermore i cannot find any references to the classes
radio
andradio-success
in bootstrap 4, these 2 are added inpost_widget_render
forRadioSelect
.After browsing through the django-bootstrap4 code quickly i found
def radio_list_to_class(self, html, klass)
which maps<li>
and</li>
to empty string. If the radio buttons really are supposed to be inside a div with classform-check
then we should probably change the mapping to look like thisTrying this locally at least I get the default stacked layout that I expected, but I'm not sure if this will break some other layout. Or am I missing some other parameter here which can solve the initial problem?
The text was updated successfully, but these errors were encountered: