[Fixed]-Change Multiple Form Sizes Django Bootstrap

1👍

The easiest way to solve this is to use Crispy forms, which has support for rendering Bootstrap compatible layout. You can easily define divs and their classes in form’s helper. Here’s an example with two text fields in one row:

class SampleForm(Form):

    name = CharField()
    surname = CharField()

    helper = FormHelper()
    helper.layout = layout(
        Div(
            Div('name', css_class='col-sm-6'),
            Div('surname', css_class='col-sm-6'),
            css_class='row'
        )
    )
👤rubick

0👍

You can define your own width: 20% for 5 cells, 14,28% for 7 cells

.col-xs-20, .col-sm-20, .col-md-20,.col-lg-20,/* 5 Cells */{
    position: relative;
    min-height: 1px;
    padding-right: 10px;
    padding-left: 10px;
}
.col-xs-20{
    width: 20%;
    float: left;
 }
.col-sm-20{
  width: 20%;
  float: left;
}
.col-md-20{
  width: 20%;
  float: left;
}
.col-lg-20{
  width: 20%;
  float: left;
}

Leave a comment