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>

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.1.1

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.1.1
File Size Uploaded Provenance Actions
django_mvp_layout-0.1.1.tar.gz 20.6 kB With provenance Details for django_mvp_layout-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 43.4 kB

Release files / django_mvp_layout-0.1.1.tar.gz

Download URL django_mvp_layout-0.1.1.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ba57dfea4255df6644f7a47efaef1d27c2f4040beb9701095cb92a4359a55fef
BLAKE2b-256 checksum
How to use checksums
aafc4cbb0e9bde811566f63b9d980018d6add92956bf1e0dfd4ac1ccc55c9648
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 24, 2026.

Transparency log

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

Download URL django_mvp_layout-0.1.1-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58fb1371e7eb923462bd760929cf979e515b22ff238e64cebb0d00f6c94d5e88
BLAKE2b-256 checksum
How to use checksums
9a07cd987c07c9f8fb5049ee34dd91983b32ebf110ca6008c80b5e62ba4ca497
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 24, 2026.

Transparency log

Security for django-mvp-layout 0.1.1

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.1.1.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 24, 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