You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

django-orderable-tree

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

django-orderable-tree

Tree structure for hierarchical data

0.1.0
pipPyPI
Maintainers
1

Django Tree

CI Test Coverage Maintainability

Overview

A tree structure for hierarchical data. Optimised for fast insertion/moving of nodes around the tree.

Requirements

  • Django 3.2+
  • Python 3.8+

Installation

  • Add django_tree to INSTALLED_APPS.

Usage

Simply extend the BaseTreeNode class in your application: e.g.

from django.db import models

from django_tree.models import BaseTreeNode


class Category(BaseTreeNode):
    name = models.CharField(max_length=255)

    def __str__(self):
        return self.name

# Will contain an OrderedDict of categories organised into a tree structure.
categories = Category.objects.build_tree()

Testing

  • Install dev dependencies: poetry install.
  • Install a supported version of Django: pip install django==3.2
  • Run the tests: DB_NAME="django_tree" python -m pytest tests .

Keywords

tree

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts