Reputation: 59
I'm running Django 1.9 with Bootstrap. I use pure Django, without any crispy forms etc. Some time ago I was struggling with forms customization under Bootstrap. My friend proposed me a solution. It's working, but for me it looks really heavy.
Is there any other, simpler way to make use of Django and Bootstrap forms? What I need, is to populate values in form and send them successfuly to Django backend.
<div class="form-group row">
<label for="price" class="form-control-label col-md-3">Price</label>
<div class="col-md-9">
<input type="number" class="form-control"
value="{{ form.price.data|default:'' }}"
name='price' id='price' placeholder="Price">
</div>
</div>
Upvotes: 0
Views: 1030
Reputation: 8907
You can render your {{ form }}
by each field in html form, whith bootstrap classes like in this example:
<form action="" method="post">
<div class="row">
<div class ="col-md-6">{{ form.your_first_field }}</div>
<div class = "col-md-6">{{ form.your_second_field }}</div>
</div>
<input type="submit" class="btn btn-primary"/>
</form>
Or you can try another layout, follow by this logic
Upvotes: 1