Template tags and filters

Note

All the following examples it is understood that you have already loaded the bootstrap3 template tag library, placing the code below in the beginning that each template that bootstrap3 template tag library will be used. Read the Installation and Quickstart sections on how to accomplish this.

bootstrap_form

bootstrap3.templatetags.bootstrap3.bootstrap_form(*args, **kwargs)[source]

Render a form

Tag name:

bootstrap_form

Parameters:

args:
kwargs:

usage:

{% bootstrap_form form %}

example:

{% bootstrap_form form layout='inline' %}

bootstrap_form_errors

bootstrap3.templatetags.bootstrap3.bootstrap_form_errors(*args, **kwargs)[source]

Render form errors

Tag name:

bootstrap_form_errors

Parameters:

args:
kwargs:

usage:

{% bootstrap_form_errors form %}

example:

{% bootstrap_form_errors form layout='inline' %}

bootstrap_formset

bootstrap3.templatetags.bootstrap3.bootstrap_formset(*args, **kwargs)[source]

Render a formset

Tag name:

bootstrap_formset

Parameters:

args:
kwargs:

usage:

{% bootstrap_formset formset %}

example:

{% bootstrap_formset formset layout='horizontal' %}

bootstrap_formset_errors

bootstrap3.templatetags.bootstrap3.bootstrap_formset_errors(*args, **kwargs)[source]

Render form errors

Tag name:

bootstrap_form_errors

Parameters:

args:
kwargs:

usage:

{% bootstrap_form_errors form %}

example:

{% bootstrap_form_errors form layout='inline' %}

bootstrap_field

bootstrap3.templatetags.bootstrap3.bootstrap_field(*args, **kwargs)[source]

Render a field

Tag name:

bootstrap_field

Parameters:

args:
kwargs:

usage:

{% bootstrap_field form_field %}

example:

{% bootstrap_form form_field form.subject %}

bootstrap_label

bootstrap3.templatetags.bootstrap3.bootstrap_label(*args, **kwargs)[source]

Render a label

Tag name:

bootstrap_label

Parameters:

args:
kwargs:

usage:

{% bootstrap_label FIXTHIS %}

example:

{% bootstrap_label FIXTHIS %}

bootstrap_button

bootstrap3.templatetags.bootstrap3.bootstrap_button(*args, **kwargs)[source]

Render a button

Tag name:

bootstrap_button

Parameters:

args:
kwargs:

usage:

{% bootstrap_button FIXTHIS %}

example:

{% bootstrap_button FIXTHIS %}

bootstrap_icon

bootstrap3.templatetags.bootstrap3.bootstrap_icon(icon)[source]

Render an icon

Tag name:

bootstrap_icon

Parameters:

icon:icon name

usage:

{% bootstrap_icon "icon_name" %}

example:

{% bootstrap_icon "star" %}

buttons

bootstrap3.templatetags.bootstrap3.bootstrap_buttons(parser, token)[source]

Render buttons for form

Tag name:

bootstrap_buttons

Parameters:

parser:
token:

usage:

{% bootstrap_buttons FIXTHIS %}

example:

{% bootstrap_buttons FIXTHIS %}

bootstrap_messages

bootstrap3.templatetags.bootstrap3.bootstrap_messages(context, *args, **kwargs)[source]

Show django.contrib.messages Messages in Bootstrap alert containers

Tag name:

bootstrap_messages

Parameters:

context:
args:
kwargs:

usage:

{% bootstrap_messages FIXTHIS %}

example:

{% bootstrap_messages FIXTHIS %}

bootstrap_pagination

bootstrap3.templatetags.bootstrap3.bootstrap_pagination(page, **kwargs)[source]

Render pagination for a page

Tag name:

bootstrap_pagination

Parameters:

page:
kwargs:

usage:

{% bootstrap_pagination FIXTHIS %}

example:

{% bootstrap_pagination FIXTHIS %}

bootstrap_jquery_url

bootstrap3.templatetags.bootstrap3.bootstrap_jquery_url()[source]

Tag name:

bootstrap_jquery_url

Return the full url to jQuery file to use

Default value: //code.jquery.com/jquery.min.js

This value is configurable, see Settings section

usage:

{% bootstrap_jquery_url %}

example:

{% bootstrap_jquery_url %}

bootstrap_javascript_url

bootstrap3.templatetags.bootstrap3.bootstrap_javascript_url()[source]

Return the full url to the Bootstrap JavaScript library

Default value: None

This value is configurable, see Settings section

Tag name:

bootstrap_javascript_url

usage:

{% bootstrap_javascript_url %}

example:

{% bootstrap_javascript_url %}

bootstrap_css_url

bootstrap3.templatetags.bootstrap3.bootstrap_css_url()[source]

Return the full url to the Bootstrap CSS library

Default value: None

This value is configurable, see Settings section

Tag name:

bootstrap_css_url

usage:

{% bootstrap_css_url %}

example:

{% bootstrap_css_url %}

bootstrap_css

bootstrap3.templatetags.bootstrap3.bootstrap_css()[source]

Return HTML for Bootstrap CSS Adjust url in settings. If no url is returned, we don’t want this statement to return any HTML. This is intended behavior.

Default value: FIXTHIS

This value is configurable, see Settings section

Tag name:

bootstrap_css

usage:

{% bootstrap_css %}

example:

{% bootstrap_css %}

bootstrap_javascript

bootstrap3.templatetags.bootstrap3.bootstrap_javascript(jquery=None)[source]

Return HTML for Bootstrap JavaScript Adjust url in settings. If no url is returned, we don’t want this statement to return any HTML. This is intended behavior.

Default value: None

This value is configurable, see Settings section

Tag name:

bootstrap_javascript

Parameters:

jquery:Truthy to include jQuery as well as Bootstrap

usage:

{% bootstrap_javascript %}

example:

{% bootstrap_javascript jquery=1 %}