Skip to content

Commit 7a36bc8

Browse files
committed
1 parent 404d828 commit 7a36bc8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

flask_admin/templates/bootstrap4/admin/lib.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,16 @@
119119
{% set direct_error = h.is_field_error(field.errors) %}
120120
{% set prepend = kwargs.pop('prepend', None) %}
121121
{% set append = kwargs.pop('append', None) %}
122-
<div class="form-group {{ kwargs.get('column_class', '') }}">
123-
<label for="{{ field.id }}" class="col-form-label {% if field.widget.input_type == 'checkbox' %}d-block mb-0{% endif %}">{{ field.label.text }}
122+
<div class="form-group {% if theme.horizontal %}row {% endif %}{{ kwargs.get('column_class', '') }}">
123+
<label for="{{ field.id }}" class="col-form-label {% if theme.horizontal %}col-sm-2 {% endif %}{% if field.widget.input_type == 'checkbox' %}d-block mb-0{% endif %}">{{ field.label.text }}
124124
{% if h.is_required_form_field(field) %}
125125
<strong class="text-danger">&#42;</strong>
126126
{%- else -%}
127127
&nbsp;
128128
{%- endif %}
129129
</label>
130-
{% if prepend or append %}
131-
<div class="input-group">
130+
{% if prepend or append or theme.horizontal %}
131+
<div class="{% if prepend or append %}input-group {% endif %}{% if theme.horizontal %}col-sm-10{% endif %}">
132132
{%- if prepend -%}
133133
<div class="input-group-prepend">
134134
{{ prepend }}
@@ -162,7 +162,7 @@
162162
{{ field.description|safe }}
163163
</small>
164164
{% endif %}
165-
{% if prepend or append %}
165+
{% if prepend or append or theme.horizontal %}
166166
</div>
167167
{% endif %}
168168
{% if caller %}

flask_admin/theme.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class BootstrapTheme(Theme):
1515
base_template: str = 'admin/base.html'
1616
swatch: str = 'default'
1717
fluid: bool = False
18+
horizontal: bool = False
1819

1920

2021
Bootstrap4Theme = partial(BootstrapTheme, folder='bootstrap4')

0 commit comments

Comments
 (0)