[ad_1]
https://i.ytimg.com/vi/_oMY2o2NhWM/hqdefault.jpg
Enjoyed my video? Leave a like!
GitHub Link: https://github.com/maxg203
Personal Website: http://maxgoodridge.com
Original source
[ad_1]
https://i.ytimg.com/vi/_oMY2o2NhWM/hqdefault.jpg
Enjoyed my video? Leave a like!
GitHub Link: https://github.com/maxg203
Personal Website: http://maxgoodridge.com
Original source
5 responses to “How to Apply Bootstrap CSS to a Django Form (Django Tutorial) | Part 50”
There is an easier way I think.. instead of templating the form into html via {{ form.as_p }} or any other way .. you'd do this ..
{% for el in forms %}
<label class="Whateverclass">{{ el.label_tag }}</label>
<div class="whateverdiv">
{{ el }}
</div>
el.label_tag is the label of the forms like.. "post".. and just el is the actual input etc.
{% endfor %}
There is even easier way to add class to django widgets: if you are using virtualenv just add class="form-control" to your django files:
env/lib/python3.5/site-packages/django/forms/templates/django/forms/widgets/input.html
env/lib/python3.5/site-packages/django/forms/templates/django/forms/widgets/textarea.html
Then each form field rendered with TextInput() widget will have class="form-control" ๐ And you don't have to add attr everytime you are creating a form field ๐
great thanks to you dude.this is what i have been searching since yesterday.finally here it's
Hi, can you please give a demonstration on a scheduling application with bootstrap calendar, python and django deaturing rabbitmq. ๐
Here is the code up to the end of Part 50: https://github.com/ankoorb/Django-Practice/tree/master/tutorial-50