html - Django forms with custom bootstrap layout -


i'm running django 1.9 bootstrap. use pure django, without crispy forms etc. time ago struggling forms customization under bootstrap. friend proposed me solution. it's working, me looks heavy.

is there other, simpler way make use of django , bootstrap forms? need, populate values in form , send them successfuly 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> 

you can render {{ form }} each field in html form, whith bootstrap classes in 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 can try layout, follow logic


Comments

Popular posts from this blog

multithreading - Exception in Application constructor -

React Native allow user to reorder elements in a scrollview list -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -