Skip to main content

django-children-models-dependencies provides tools to get the dependencies in a tree of django models

Project description

Purpose

This is a small app that allow to get the children of a base model, in an dependency order from the model with the less dependencies, to the model with the more dependencies, each model coming after its own dependencies

For example, for theses models:

class BaseModel(models.Model):
    class Meta:
        abstract = True

class ChildModel1(BaseModel):
    pass

class ChildModel2(BaseModel):
    link = models.ForeignKey('myapp.ChildModel3', on_delete=models.CASCADE)


class ChildModel3(BaseModel):
    pass

The order will be:

from django_children_models_dependencies.manager import ChildrenDependenciesManager

self.assertListEqual(ChildrenDependenciesManager.get_children_dependencies(BaseModel), [
    ChildModel1,  # first model without dependencies
    ChildModel3,  # dependency of ChildModel2, so it comes before
    ChildModel2,  # last one, which must come after its own dependencies
])

Installation

Install from PyPI:

pip install django-children-models-dependencies

Requirements

  • Python 3.9, 3.10, 3.11, 3.12

  • Django 4.2, 5.0, 5.1

Project details


Download files

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

Source Distribution

django_children_models_dependencies-1.2.1.tar.gz (64.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file django_children_models_dependencies-1.2.1.tar.gz.

File metadata

File hashes

Hashes for django_children_models_dependencies-1.2.1.tar.gz
Algorithm Hash digest
SHA256 fdb6d705452bc1e818dfdf07f500a228344a5e655326048849c8c4e68466df72
MD5 61ff2dee49b539a617bdda4a205f3b2b
BLAKE2b-256 4f42201bf5c627458d578e820cded8d994a3e4acca70fb8e27cf9d07700a83d2

See more details on using hashes here.

File details

Details for the file django_children_models_dependencies-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_children_models_dependencies-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e837e9ee52622e9673642bdffa31e441c327a7f0cc4dfcd89f177db20b9920df
MD5 6502977b042fc0f86c29edf46ac1dec4
BLAKE2b-256 a41078365a3136700a886c11a003423db4ba5d162e33346d2bcae878f5fd6938

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page