Package: django-bootstrap-sidebar
Collapsible Sidebar Using Bootstrap for DJangoCollapsible Sidebar Using Bootstrapis a base template with a bootstrap simple
customization in self-hosted mode (non-CDN).Features:Bootstrap 5.3Django 4Templates included:bootstrap_base.htmlbootstrap_popovers.htmlregistration/login.htmlsnippets/show_err.htmlsnippets/show_messages.htmlBootstrap customization available at bootstrap-theme directory.Custom font from google-fonts in local static files.Bootstrap theme and fonts are customizable using scripts included. See detailsbellow.PreviewInstallationThe preferred way to install is via pippip3 install django-bootstrap-sidebarbut you can install in develop mode cloning this repo but static files are not
included in the repo. SeeCustomize bootstrap theme sectionfor details.After the installation insettings.pyof your Django instance
addbootstrapsidebar:INSTALLED_APPS=[...'bootstrapsidebar'...]Testing example base-templatesTo test the sidebar and login pages add tourls.py:fromdjango.views.genericimportTemplateViewfromdjango.contrib.authimportviewsasauth_viewsurlpatterns=[...path('demo',TemplateView.as_view(template_name="bootstrap_base.html"),name='demo'),path('popovers',TemplateView.as_view(template_name="bootstrap_popovers.html"),name="popovers"),path('login',auth_views.LoginView.as_view(),name="login"),Pages can be tested at:http://localhost:8000/demohttp://localhost:8000/loginhttp://localhost:8000/popoversBlocks available in page layoutThe base template (bootstrap_base.html) includes the following hierarchical
blocks:block custom-cssblock headblock page-wrapper: to override full page, included sidebar.block sidebarblock navbar: to override top navbarnavbar-links: only to add links in default template navbar.block messages: by default this block usessnippets/show_messages.htmlblock contentblock footerblock after-bootstrap-js: used to run extra javascript like to enable Bootstrap Popovers.See below detailsTheregistration/login.htmlis an example page using base-template without
sidebar.Customize bootstrap themeInstall the package in dev mode is recommended if you want to customize the
Bootstrap Theme. First clone this repo and install in dev mode:pip install -e ./django-bootstrap-sidebarBootstrap static files and fonts are not included in the repo. They are
generated/downloaded with the commands of makefile but thenodeenvironment
andnpmare required.Bootstrap can be customized at filebootstrap-theme/custom.scss. An easy way
to create a new customization is some online theme builder
likehttps://bootstrap.build/and download thecustom.scss.To generate/upgrade static files makefile automates the process, run make:makeEnable Bootstrap PopoversDue performance reasons popovers are not default enabled. One way is to enable
popovers everywhere, which requires an extra javascript after the Bootstrap
javascript. The last solution is not optimal, but it is a simple way, a detailed instructions are available atBootstrap
PopoversThe blockafter-bootstrap-jsis intended  to enable popovers and
the following code snippet from Bootstrap can be used:{% block after-bootstrap-js %}<script>constpopoverTriggerList=document.querySelectorAll('[data-bs-toggle="popover"]')constpopoverList=[...popoverTriggerList].map(popoverTriggerEl=>newbootstrap.Popover(popoverTriggerEl))</script>{% endblock %}A full example is available at templatebootstrap_popovers.htmlLicenseThe project is licensed under the Apache 2.0 license.AuthorDeveloped and maintained by Paulino Ruiz de Clavijo Vázquezpruiz@us.es