Django-bootstrap5 и выравнивание кнопок

Я хочу отобразить кнопку рядом с формой, а не ниже:

Вот как это выглядит:

enter image description here

должен выглядеть следующим образом:

enter image description here

соответствующий код:

Форма:

class TheForm(forms.Form):
    var = forms.ChoiceField(choices = choices, label = "")

temp

late:

{% if TheForm %}
    <form method = "post">
        {% csrf_token %}
        {% bootstrap_form TheForm %}
        {% bootstrap_button button_type="submit" content="OK" %}
    </form>
 {% endif %}

Попробуйте систему сетки bootstrap,

template.html

{% if TheForm %}
    <form method = "post">
        {% csrf_token %}
        <div class="row"> <!-- creates a row of 12 parts -->
            <div class="col-lg-9"> <!-- Creates a column with width of 9 parts out of the above 12 parts -->
                {% bootstrap_form TheForm %}
            </div>
            <div class="col-lg-3">  <!-- Creates a column with width of remaining 3 parts out of the above 12 parts -->
                {% bootstrap_button button_type="submit" content="OK" %}
            </div>
        </div>
    </form>
 {% endif %}
Вернуться на верх