[Answer]-Django-crispy-forms inline divs

1👍

Example (coordinates):

    self.helper_coordinate = FormHelper()
    self.helper_coordinate.layout = Layout(
        Div(
            HTML(u'<div class="col-xs-2" style="line-height:35px;"><strong>Latitude:</strong></div>'),
            Div(AppendedText('lat_deg', '°'), css_class='col-xs-3'),
            Div(AppendedText('lat_min', '\''), css_class='col-xs-3'),
            Div(AppendedText('lat_sec', '"'), css_class='col-xs-4'),
            css_class='row-fluid'  # here you can add some custom class, for example 'row-fluid margin-top-15'
        ),
        Div(
            HTML(u'<div class="col-xs-2" style="line-height:35px;"><strong>Longitude:</strong></div>'),
            Div(AppendedText('lon_deg', '°'), css_class='col-xs-3'),
            Div(AppendedText('lon_min', '\''), css_class='col-xs-3'),
            Div(AppendedText('lon_sec', '"'), css_class='col-xs-4'),
            css_class='row-fluid'
        ),
    )

Leave a comment