A reusable Django sidebar for Web Apps
Project description
Micro Sidebar
A reusable Django sidebar app for Web Apps.
Requirements
- Django: >= 5.1
- Bootstrap: 5 (Required for consistent styling)
Installation
-
Install the package:
pip install micro-sidebar
-
Add to
INSTALLED_APPS: In yoursettings.py:INSTALLED_APPS = [ ... 'sidebar', ... ]
-
Configure URLs: In your project's
urls.py:from django.urls import path, include urlpatterns = [ ... path('sidebar/', include('sidebar.urls')), ... ]
-
Add to your Base Template: In your
base.html(or equivalent), include the sidebar. It is designed to sit on the left (or right in RTL) of your main content.Example structure using Flexbox:
<body> <div class="d-flex"> <!-- Sidebar --> {% include "sidebar/content.html" %} <!-- Main Content --> <div class="flex-grow-1"> {% block content %}{% endblock %} </div> </div> <!-- Bootstrap JS (Required) --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> </body>
Customization
Overriding Content
The sidebar comes with a default template. To customize the links and content, create a file named content.html inside templates/sidebar/ in your project's templates directory.
Path: your_project/templates/sidebar/content.html
The default sidebar logic expects specific classes like .list-group-item and .accordion-item for the collapsible features to work correctly with the provided JS.
Positioning
The sidebar is sticky by default. If your app has a top navigation bar (titlebar), the sidebar will automatically adjust its position below it on small screens. If no titlebar is detected, it will stick to the top of the viewport.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters