Skip to main content

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

  1. Install the package:

    pip install micro-sidebar
    
  2. Add to INSTALLED_APPS: In your settings.py:

    INSTALLED_APPS = [
        ...
        'sidebar',
        ...
    ]
    
  3. Configure URLs: In your project's urls.py:

    from django.urls import path, include
    
    urlpatterns = [
        ...
        path('sidebar/', include('sidebar.urls')),
        ...
    ]
    
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

micro_sidebar-1.0.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

micro_sidebar-1.0.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file micro_sidebar-1.0.1.tar.gz.

File metadata

  • Download URL: micro_sidebar-1.0.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for micro_sidebar-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0637d9c5a43e820bc2f9ae9159753d7dcc50f7cc85cd5a184a9c1b7cfb854d18
MD5 034ee79081c8931f256867784e80b2a6
BLAKE2b-256 7251eedd48e6ab000a69ce29b4c4a4ee04a8aeb9b86245589dffac430ccba309

See more details on using hashes here.

File details

Details for the file micro_sidebar-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: micro_sidebar-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for micro_sidebar-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 079574e4ea3e3b690e8d1df0f5f9c35744414a6be7766a1fd0c465aec6aa1e6d
MD5 ae1cccbc9794366cebe17f0d59a5895a
BLAKE2b-256 52139088847e2debd3b65f8e9c33f69415fe7af1e308ef17e0225b5880a390cb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page