Giter Site home page Giter Site logo

beatonma / django-model-dependencies Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 68 KB

Tool for visualising relationships between Django Models. Generates an image showing how models in a project are connected via inheritance and ForeignKey(, etc) fields. #weekendproject

Python 100.00%

django-model-dependencies's Introduction

Example output

A tool to visualise relationships between Django Models in a project.

Requirements

Dataclasses are used so Python 3.8 is required. This is a quick project I made to use myself. If you want to use an older version of Python then you will need to replace the Field and PyClass classes.

Installation

git clone https://github.com/beatonma/django-model-dependencies
cd django-model-dependencies/

# activate virtual environment here if you want

# then
python setup.py install

Then you can run it with:

djmodgraph 'path/to/directory'

or to build a graph of the current directory:

djmodgraph .

Command line arguments

--savas SAVEAS: Save the graph to the given filename.

--models MODELS [MODELS ...]: The output graph will show only these models and their direct relationships to other models.
Filtered output --models Party

-noshow: Use alongside --saveas to bypass showing the image.

-nofields: Ignore field-based relationships - ForeignKey, OneToOneField, ManyToManyField.

-nosubclass: Ignore class inheritance-based relationships.

-noabstract: Ignore abstract models (mixins, base model classes - anything with class Meta: abstract = True)

-fieldsonly: Equivalent to -noabstract -nosubclass

-subclassonly: Equivalent to -nofields

Testing

Clone the repo as above then run:

python setup.py test

django-model-dependencies's People

Contributors

beatonma avatar

Stargazers

Nikolaus Schlemm avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.