我想在表單旁邊而不是下面顯示一個按鈕:
這是它的外觀:

應該是這樣的:

對應代碼:
形式:
class TheForm(forms.Form):
var = forms.ChoiceField(choices = choices, label = "")
溫度
late:
{% if TheForm %}
<form method = "post">
{% csrf_token %}
{% bootstrap_form TheForm %}
{% bootstrap_button button_type="submit" content="OK" %}
</form>
{% endif %}
uj5u.com熱心網友回復:
嘗試引導網格系統,
模板.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 %}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/381157.html
標籤:姜戈 django-forms django-模板 bootstrap-5
上一篇:視圖Fitness_app.views.BookingView沒有回傳HttpResponse物件。它回傳None代替
