Skip to main content

Materialized tree for Django 3.x

Project description

GihHub Action Requirements Status Codacy grade pypi


  • Python 3.6+
  • A supported version of Django (currently 3.x)

Getting It

You can get Django tree materialized by using pip:

$ pip install django-tree-materialized

If you want to install it from source, grab the git repository from GitHub and run

$ git clone git://
$ cd django_tree_materialized
$ python install


To enable django_tree_materialized in your project you need to add it to INSTALLED_APPS in your projects

    # ...
    # ...


Add to your

from django_tree_materialized.models import MPTree

class YouModel(MPTree):
    name = models.CharField(max_length=200)

Simple example

name = models.YouModel.create(name="Name name")
sub = models.YouModel.create(name="Name node2", parent=name)

# Get a list of parents
result = name.get_family() # Return QuerySet object
for item in result:
    print(,, item.level, item.path, item.parent)


get_family() - Get a list of parents

get_parent() - Return parent

get_root() - Return root object

move() - Moves one node to another


name = models.YouModel.create(name="Name name")
new_name = models.YouModel.create(name="Name node2")

result = name.move(new_name) # Return QuerySet new_name object

Project details

Download files

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

Files for django-tree-materialized, version 0.0.6
Filename, size File type Python version Upload date Hashes
Filename, size django_tree_materialized-0.0.6-py3-none-any.whl (13.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django-tree-materialized-0.0.6.tar.gz (10.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page