Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences between django-bootstrap4 and bootstrap4?

I am beginner in Django web development & currently I am using using bootstrap4 by loading bootstrap.min.css & bootstrap.min.js as below in html files.

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>

Recently I have found that there been module in Django named django-bootstrap4 & I am reading its documentation also.

https://django-bootstrap4.readthedocs.io/

I have tried to find difference between those but not found any.

Which will be suitable to use in web development?

Tried to find answer on google but not found any so please can someone explain me difference between these two?

like image 924
Moon Avatar asked Mar 18 '20 05:03

Moon


Video Answer


1 Answers

The Bootstrap itself is an independent CSS framework that you can use to build your UI no matter the application framework. But django-bootstrap4 is basically a helper library to seamlessly integrate Bootstrap with your Django project UI.

For example consider you want to use alert component in Bootstrap. After adding bootstrap.min.css & bootstrap.min.js to your template, every time you want to show the alert you should add code like this:

<div class="alert alert-danger" role="alert">
  Something went wrong
</div>

But with django-bootstrap4 you can simply use {% load bootstrap4 %} in your template and then there in no need to writing all the tags and classes.

{% bootstrap_alert "Something went wrong" alert_type='error' %}

So they are basically is the same but the later is cleaner and more maintainable.

like image 86
mhrabiee Avatar answered Sep 17 '22 18:09

mhrabiee