django-nifty-layout
Version: 0.2.2
A simple but flexible layout tool for composing and transforming data for structured template components.
Inspired by crispy-forms Layout, but without the forms.
django-nifty-layout is free software distributed under the MIT License.
Quick Start
-
Install the
django-nifty-layoutpackage from PyPI$ pip install django-nifty-layout
-
Go grab a drink, you are all done!
Sample Usage
layout.py
from django.utils.formats import date_format
from nifty_layout.components import (
DictCompositeNode as Dct,
FieldNode as Fld,
Seq,
)
# ----- Safe Date Formatter ----- #
date_formatter = lambda val, **kwargs: "" if val is None else date_format(val, SHORT_DATE_FORMAT)
layout = Dct(
dict(
overview=Seq(
"title",
Fld("date", formatter=date_formatter),
report_type",
"location",
labeller="Overview",
),
contacts=Seq(
Dct(dict(
name="contact_name",
contact_methods=Seq("contact_email"),
), labeller="Primary Contact"
),
Dct(dict(
name="reported_by_name",
contact_methods=Seq("reported_by_phone_num", "reported_by_email"),
), labeller="Reported By"
),
labeller="Contacts",
),
...
)
)
views.py
def report_view(request, pk):
...
obj = Report.objects.get(pk=pk)
...
return render(request, "template.html", dict(report=layout.bind(obj)))
template.html
...
<div class="report>
<h2>report.overview.label</h2>
{% for node in report.overview %}
<div class="row">
<div class="col label">{{ node.label }}</div>
<div class="col value">{{ node.value|default:"" }}</div>
{% endfor %}
</div>
{% endfor %}
<div class="row">
{% for contact in report.contacts %}
<div class="col">
{% include "contact_card.html" %}
</div>
{% endfor %}
</div>
...
</div>
Get Me Some of That
Check Out the Demo App
pip install -e git+https://github.com/powderflask/django-nifty-layout.git#egg=django-nifty-layoutinv demo.install** coming soon **python demo_app/manage.py runserver
See demo_app/README
Acknowledgments
This project would be impossible to maintain without the help of our generous contributors
Technology Colophon
Without django and the django dev team, the universe would have fewer rainbows and ponies.
This package was originally created with cookiecutter
and the cookiecutter-powder-pypackage project template.
For Developers
Install invoke, pip-tools, tox for all the CLI goodness
pip install invoke pip-tools tox
Initialise the development environment using the invoke task
inv tox.venv
Or create it with tox directly
tox d -e dev .venv
Or build and install the dev requirements with pip
inv deps.compile-dev
pip install -r requirements_dev.txt
Tests
pytest
or
tox r
or run tox environments in parallel using
tox p
Code Style / Linting
$ isort
$ black
$ flake8
Versioning
- Semantic Versioning
$ bumpver show
Build / Deploy Automation
- invoke
$ invoke -l
- GitHub Actions (see .github/workflows)
- GitHub Webhooks (see settings/hooks)
Metadata
Release files for django-nifty-layout 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django_nifty_layout-0.2.2.tar.gz | 15.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_nifty_layout-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.9 kB
Release files / django_nifty_layout-0.2.2.tar.gz
| Download URL | django_nifty_layout-0.2.2.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7289ddac4bd11361f0c4b64be665828e7283508381b066c194f1fc8ed21a6cf
|
|
BLAKE2b-256 checksum How to use checksums |
6cdbe510b7d78bcd5507d0fc9af4dc00ad083d0e1e1f55e6822802af7d23eaaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 7, 2026.
Transparency logRelease files / django_nifty_layout-0.2.2-py3-none-any.whl
| Download URL | django_nifty_layout-0.2.2-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f10e5e17a06d9c010703026a4602eb56c726b6531e3b6a104866c59871172e7e
|
|
BLAKE2b-256 checksum How to use checksums |
5ea475736306f4b70c553201ccfc8dbf793ba09e27967f4213f78d2ab031b773
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 7, 2026.
Transparency logSecurity for django-nifty-layout 0.2.2
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for django_nifty_layout-0.2.2.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 Jun 7, 2026.
Transparency logA 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.