Skip to main content

django-mvp-layout

Tests Build Publish codecov PyPI Python Django License

Page layouts arranged by a nine-letter layout code, with sidebars that open, close, collapse and nest

Scope & philosophy

The package arranges a header, two sidebars, a page and a footer, and makes the sidebars behave: they open and close, shrink to an icon rail, become drawers on a narrow layout, and remember their state. A layout is a page or a box inside one, and it nests inside itself. The package renders markup and ships one stylesheet and one script. It has no models, views, URLs or settings, and it leaves the look of everything inside the areas to the host project.

When two designs conflict, the one that keeps a layout accessible and its markup readable wins over the one with more options.

Installation

pip install django-mvp-layout

Then add it to INSTALLED_APPS, after mvp:

INSTALLED_APPS = [
    # ...
    "mvp",
    "mvp_layout",
]

Usage

A layout is written with Cotton components, or in a plain base template that the pages of your project extend.

With django-cotton

Load the stylesheet and script in the head, then write the layout:

{% load static %}
<link rel="stylesheet" href="{% static 'mvp_layout/layout.css' %}" />
<script src="{% static 'mvp_layout/layout.js' %}"></script>

<c-layout view="lHh LpR lff">
  <c-layout.header><c-layout.toggle when="closed" /> My project</c-layout.header>
  <c-layout.sidebar label="Navigation">…</c-layout.sidebar>
  <c-layout.page tag="main">…</c-layout.page>
  <c-layout.footer>…</c-layout.footer>
</c-layout>

Give a sidebar view="HbF" and write its content in <c-layout.header>, <c-layout.body> and <c-layout.footer> to keep its header at the top and its footer at the bottom while it scrolls.

In a plain template

  1. Copy docs/examples/base.html to your project's templates/base.html, and add django.template.context_processors.request to your template settings.

  2. Keep the three things the layout needs: {% layout_attrs %} on the root element, {% sidebar_attrs %} on each sidebar, and the stylesheet and script in the head:

    {% load static mvp_layout %}
    <link rel="stylesheet" href="{% static 'mvp_layout/layout.css' %}" />
    <script src="{% static 'mvp_layout/layout.js' %}"></script>
    
  3. Extend it in a page, filling the header, navigation, content, aside and footer blocks.

The nine-letter code in {% layout_attrs "hHh LpR fFf" %} places the areas. The developer guide covers the code, the components, both tags, styling, right-to-left pages and MvpLayout, the script a page of your own uses to open and close sidebars.

Contributing

Standards for this repository live in CONSTITUTION.md, and the vocabulary to use in issues and commits lives in CONTEXT.md.

uv sync
uv run pytest
uv run pre-commit install

demo/ is a Django project that shows the layouts in a browser while you work on this package, with an overview, a playground, a nested-layouts page and a Without Cotton page:

uv run python manage.py runserver

License

MIT. See LICENSE.

Metadata

Release files for django-mvp-layout 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-mvp-layout 0.2.0
File Size Uploaded Provenance Actions
django_mvp_layout-0.2.0.tar.gz 21.2 kB With provenance Details for django_mvp_layout-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-mvp-layout 0.2.0
File Interpreter ABI Platform Actions
django_mvp_layout-0.2.0-py3-none-any.whl Python 3 none any Details for django_mvp_layout-0.2.0-py3-none-any.whl

Total release size: 45.1 kB

Release files / django_mvp_layout-0.2.0.tar.gz

Download URL django_mvp_layout-0.2.0.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8566597afaaa5f0933ab16e68601c1d84319e29f89d53ab21eb40079e538dcf1
BLAKE2b-256 checksum
How to use checksums
a331ff9cac68b993d354c24ce3de7852a866b69adfe5e791e484d6b62e8922c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / django_mvp_layout-0.2.0-py3-none-any.whl

Download URL django_mvp_layout-0.2.0-py3-none-any.whl
Size 23.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b30de85fcedd57111c003f33b42bb51f5f511e1175454393734e1e06d9ddd3f3
BLAKE2b-256 checksum
How to use checksums
3365a59caa8f91cc35a7f920c1cb5c2c3fb1a7bedd2fcf21eb6716c9508b8eca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for django-mvp-layout 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_mvp_layout-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page