• Thursday , 16 November 2017

How to Apply Bootstrap CSS to a Django Form (Django Tutorial) | Part 50

Code Canyon
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

3d Ocean

Related Posts

5 Comments

  1. The Dardans
    September 13, 2017 at 10:15

    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 %}

  2. korwin
    September 13, 2017 at 10:15

    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 🙂

  3. Jagadish .A
    September 13, 2017 at 10:15

    great thanks to you dude.this is what i have been searching since yesterday.finally here it's

  4. Aakash Manandhar
    September 13, 2017 at 10:15

    Hi, can you please give a demonstration on a scheduling application with bootstrap calendar, python and django deaturing rabbitmq. 🙂

  5. Ankoor Bhagat
    September 13, 2017 at 10:15

    Here is the code up to the end of Part 50: https://github.com/ankoorb/Django-Practice/tree/master/tutorial-50

Leave A Comment

You must be logged in to post a comment.