Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use django-bootstrap3

I have a django website, and now I want to use bootstrap. I found django-bootstrap3: django-bootstrap3

First I installed the package over pycharm. Like in quickstart, I can load:

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

{# Load CSS and JavaScript #}
{% bootstrap_css %}
{% bootstrap_javascript %}

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

But for

{% bootstrap_form form %}

I get an error:

Invalid block tag on line 22: 'bootstrap_form', expected 'endblock'. Did you forget to register or load this tag?

how to fix this error?

PS: I have added bootstrap3 to Installed_Apps in my settings.py

like image 980
spitzbuaamy Avatar asked Jan 26 '26 18:01

spitzbuaamy


1 Answers

Add {% load bootstrap3 %} to child template file after the {% extends 'site_base.html' %}.

like image 57
doru Avatar answered Jan 28 '26 07:01

doru