skip to navigation
skip to content

django-cs-models 1.0.0

A Django app that helps you creating models within a Complex System.

Django Complex System Models

A Django app that helps you creating models within a Complex System.

License

Software licensed under MPL 2.0 license.

Installation

pip install django-cs-models

Usage

Two parameters have to be set in your settings. Here is an example:

COMPLEX_APP_NAME = 'ecosystem'

COMPLEX_STRUCTURE = {
    'roots': [
        ['Organization', 'Committee', 'Board', 'Cohort'],
    ],
    'nodes': [
        ['ProjectTeam'],
        ['Resource'],
        ['Member'],
    ]
}

Roots are entities that contain nodes (a root cannot contain another root). Nodes are entities contained by and containing other nodes.

You can define roots and nodes at different levels, i.e. their position in the hierarchy. These levels will tell if such entity can be contained by such other entity.

Now in ecosystem app:

from csmodels.models import abstract_model

class Cohort(abstract_model('Cohort')):
    your_model_fields_here = models.SomeField()

    class Meta:
        verbose_name = _('Cohort')
        verbose_name_plural = _('Cohorts')

The cohort model will inherit many to many relationships to project teams, resources and members from the abstract model.

Of course, a change in the complex structure will change the models, therefore migrations will be needed!

First diagram shows the example above.

Second diagram shows how links are created between entity depending on their type (root or node) and their level. Letters (their names) are not important, but numbers (their levels) are.

Development

To run all the tests: tox

Changelog

0.1.0 (2016-10-06)

  • Alpha release on PyPI.
 
File Type Py Version Uploaded on Size
django-cs-models-1.0.0.tar.gz (md5) Source 2016-10-06 20KB
django_cs_models-1.0.0-py2.py3-none-any.whl (md5) Python Wheel py2.py3 2016-10-06 6KB