Quickstart#

After Installation, you can use django-bootstrap4 in your templates.:

Load the bootstrap4 library and use the bootstrap_* tags:

Example template#

{# Load the tag library #}
{% load bootstrap4 %}

{# Load CSS and JavaScript #}
{% bootstrap_css %}
{% bootstrap_javascript jquery='full' %}

{# Display django.contrib.messages as Bootstrap alerts #}
{% bootstrap_messages %}

{# Display a form #}
<form action="/url/to/submit/" method="post" class="form">
  {% csrf_token %}
  {% bootstrap_form form %}
  {% buttons %}
    <button type="submit" class="btn btn-primary">
      Submit
    </button>
  {% endbuttons %}
</form>

{# Read the documentation for more information #}

Template tags and filters#

Refer to Template tags and filters for more information.

Settings#

You can set defaults for django-bootstrap4 in your settings file. Refer to Settings for more information.

Example application#

The example application provides a number of useful examples.

https://github.com/zostera/django-bootstrap4/tree/main/example