django-crispy-forms / django-crispy-forms

The best way to have DRY Django forms. The app provides a tag and filter that lets you quickly render forms in a div format while providing an enormous amount of capability to configure and control the rendered HTML.
http://django-crispy-forms.rtfd.org
MIT License
5.03k stars 733 forks source link

New changes are required for bootstrap4-alpha5 horizontal forms and grid layout. #658

Closed darklow closed 7 years ago

darklow commented 7 years ago

New changes are necessary for Bootstrap4-alpha5 (some since alpha-3):

  1. .form-control-label was renamed to .col-form-label (since alpha-3) Evidence and current markup for horizontal forms: http://v4-alpha.getbootstrap.com/components/forms/#using-the-grid

  2. .form-group is required to use together with .row again. Evidence and current markup for horizontal forms: http://v4-alpha.getbootstrap.com/components/forms/#using-the-grid Related to #636

  3. .col-*-offset-* are changed to .offset-*-* (since alpha-3) http://v4-alpha.getbootstrap.com/layout/grid/#example-offsetting-columns. It would affect these recently made changes as well: https://github.com/django-crispy-forms/django-crispy-forms/pull/657/commits/832bc4bf1df87ebd15e2a09321c3e90cb5776fa3

  4. .form-control-feedback is required for field error messages: http://v4-alpha.getbootstrap.com/components/forms/#validation

Since I am familiar with changes I am willing to make a PR, if you're ready to accept changes for newest bootstrap4 alpha3-alpha5 changes. Users with bootstrap 4 < alpha3 will experience changes, but I think we must continue follow new bootstrap4 alphas markup.

carltongibson commented 7 years ago

@darklow — PR: Yes please 🙂

We can roll a new release for this. If we highlight in the change notes what the "supported" version is then users can stick with the old version if they need to.

I think we must continue follow new bootstrap4 alphas markup.

Exactly. Bootstrap4 support is alpha/beta for at least as long as Bootstrap 4 is. Having to update is part of the cost of being on the bleeding-edge.

darklow commented 7 years ago

@carltongibson ok great. Already working on changes. So far so good.

Have one question regarding checkbox. Bootstrap4 now supports labels for checkbox, which I find very useful thing. For example you can have label "Agreement" and near checkbox write add another label which is more explaining. In such way form design/layout isn't getting broken with gaps.

image

The question is, does anyone know any field variables we could use specifically for checkbox label or any other ideas how could we handle this? Because of this change we could get rid of is_checkbox special case handling in field.html. In terms of consistency I believe current label should go into left label column and label near checkbox should be optional.

First idea that came to my mind is - we could use help_text as label near checkbox field. What do you think?

carltongibson commented 7 years ago

...does anyone know any field variables...

Ooh. Ouch. 🙂

I think we may need to think about a custom Field subclass — or maybe something on the FormHelper — or ...

Can you open a separate ticket for that? (The question will be, "where do you want to set that text?" — what's the API we'll want.) (Definitely up for trying to support it though!)

darklow commented 7 years ago

@carltongibson Alright, will leave checkboxes currently as it is and will open new issue for discussion.

zoidyzoidzoid commented 7 years ago

Think this is now superseded by https://github.com/django-crispy-forms/django-crispy-forms/issues/732