Skip to main content
Documentation Status PyPi version

django-mptt2

Based on the idea of the unmaintained django-mptt package i implemented this new code base to replace it.

Cause no other package fits all of my use cases, which are primary in fast reading tree’s from the database, i started working on this project.

There is an alternative to this package, called django-treebeard, which implements nested sets as well, but without a parent foreignkey.

Quick-Start

Install it as any other django app to your project:

$ pip install django-mptt2

Add django-mptt2 to INSTALLED_APPS:

INSTALLED_APPS = [
    # other apps
    "mptt2"
]

Inheritance from the abstract mptt2.models.Node Model:

from django.db import models
from mptt2.models import

class Genre(Node)
    name = models.CharField(max_length=50, unique=True)

Adding nodes:

from project.models import Genre

rock = Genre(name="Rock")
rock.insert_at() # it will become the root node without target parameter

metal = Genre(name="Metal")
metal.insert_at(target=rock) # it will become the last child from rock

alternative = Genre(name="Alternative")
alternative.insert_at(target=rock) # it will become the last child from rock, the right sibling of metal

For full usage description, please read the tutorial section of our documentation.

Metadata

Release files for django-mptt2 0.3.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-mptt2 0.3.0
File Size Uploaded Provenance Actions
django_mptt2-0.3.0.tar.gz 24.4 kB Without provenance Details for django_mptt2-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-mptt2 0.3.0
File Interpreter ABI Platform Actions
django_mptt2-0.3.0-py3-none-any.whl Python 3 none any Details for django_mptt2-0.3.0-py3-none-any.whl

Total release size: 43.6 kB

Release files / django_mptt2-0.3.0.tar.gz

Download URL django_mptt2-0.3.0.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8ffb27bf0d10298d519cc3d0672a47f3a7ccebdd663ced41b098ba4348905d05
BLAKE2b-256 checksum
How to use checksums
3a7fecb099e3866574dc60d679dd670afbf4ba49a8b3f661619b6441d4ed99bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / django_mptt2-0.3.0-py3-none-any.whl

Download URL django_mptt2-0.3.0-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30ae2b5db0cf41f0879c677d9246c1e11a332575dde9e4358b3cf6efdfbf2b87
BLAKE2b-256 checksum
How to use checksums
462409c24aeae4fcd5879f58fa46f090bb430cb543bf646bdccc985e0e670654
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for django-mptt2 0.3.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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