Giter Site home page Giter Site logo

meshy / django-schema-graph Goto Github PK

View Code? Open in Web Editor NEW
343.0 9.0 9.0 1.6 MB

An interactive graph of your Django model structure

Home Page: https://pypi.org/project/django-schema-graph/

License: MIT License

Python 69.29% JavaScript 14.35% HTML 1.85% Vue 13.70% Shell 0.80%
django database-schema database-gui django-models django-schema-graph

django-schema-graph's Introduction

Django Schema Graph

Django-schema-graph makes a colourful diagram out of your Django models. The diagram is interactive, and makes it easy to toggle models and apps on/off at will.

It looks like this:

Feature Screenshot
Models models screenshot
Apps apps screenshot
Both together models and apps screenshot
Graph editor menu screenshot

(Apologies that the images above don't work on PyPI. Check it out on GitHub.)

Installation

Install from PyPI:

pip install django-schema-graph

Add to INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'schema_graph',
    ...
]

Add to your URLs.

from schema_graph.views import Schema
urlpatterns += [
    # On Django 2+:
    path("schema/", Schema.as_view()),
    # Or, on Django < 2:
    url(r"^schema/$", Schema.as_view()),
]

Use

Browse to /schema/ (assuming that's where you put it in your URLs).

You can control access to this page using the SCHEMA_GRAPH_VISIBLE setting, or by subclassing schema_graph.views.Schema and overriding access_permitted. By default the page is only visible when DEBUG is True, because we assume that you don't want to leak sensitive information about your website outside of local development.

Support

Tests run on sensible combinations of:

  • Python (3.10-3.11)
  • Django (3.2-4.1)

If you're stuck on old version of Python or Django, you may consider installing old versions. They will probably have fewer features, and there will be no support for them.

The last version to support Python 2.7 and 3.5 was 1.2.0. The last version to support Python 3.6 to 3.9 was 2.2.1.

The last version to support Django 1.8 was 1.2.0. The last version to support Django 1.9 to 3.1 was 2.2.1.

Alternatives

  • django-spaghetti-and-meatballs is great. At the time of writing, it offers a lot more detailed information on the models in the diagram, but doesn't allow them to be turned on/off in the page.

django-schema-graph's People

Contributors

dependabot[bot] avatar meshy avatar rklyne avatar tenzer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-schema-graph's Issues

Add showcase to readme

The readme should start with explaining what the app does. A picture / gif is the easiest way to explain.

Abstract models should be hidden

django-oscar uses abstract models throughout. The sidebar and graph is full of them.

It may be a bit hard to hide them, as they may be part of indirect links between models.

Many to many through connection

Note to self: make sure many-to-many connections with explicit through tables are represented nicely. Are they represented on the graph twice?

Make graphs linkable

It'd be nice if we could link to graphs showing a pre-filtered set of nodes.

I'm not sure what the best approach is for this.

Thoughts:

Should we represent the things to show in the graph, or the things we're excluding?

Is there a way to make the URL fairly readable without making it huge? Do either of these things matter? Which takes priority?

How do we load in the state when the page is rendered?

How will old links work as things are added/removed from a schema?

Updating the URL as the graph is manipulated seems to be better than having a "create link" button somewhere.

Allow static generation

The output of this project is one HTML file and one JS file. It would be valuable to be able to make a static export, so that people can embed them in their docs without needing to run a Django server.

Export graph data

Gephi [ https://gephi.org ] is a handy graph visualization tool, as is Graphviz [ https://graphviz.org ]. It would be cool if it were easy to just export the raw graph data here, and then import it a popular graph visualization tool of choice to run graph algorithms on it and study it further.

[Feature Request] Toggling schema views programmatically

Hey, firstly thanks for creating this, it's awesome. This is more of a question/feature request rather than an issue.

Can we toggle schema views programmatically without removing apps from our settings file.? (Example, different url for models etc.). I am not sure if this is possible.

Inconvenient display

I have the first main modal, the second base model and many Subclasses from the second model. Subclasses have ForeinKeys to the first model and they are displayed in a very confusing way.
изображение

Reduce emphasis on models without any data

It is not uncommon to have apps installed with no data in any of its models. It may be unused features, or it could be abstract models, etc.

Maybe empty models can be reduced in size, and given a different color, and/or pushed to the outside of the graph where possible.

A toggle might be necessary to activate this feature, to avoid hitting every single model with a query, but maybe it is possible to start with emphasis given to models that already have a cached status of being non-empty.

Make new table-based graph-editor

The sidebar is pretty crowded, so adding info to it is going to become cumbersome.

#68 introduces some improvements, but if we had a tabular interface, we could do much more advanced stuff -- show tags, show number of connections, search, sort, etc.

Cannot add item: item with id x/y already exists

When using oscar-stores, I get:

Error: Cannot add item: item with id stores/OpeningPeriod already exists
    at i.value (main.js:59)
    at i.value (main.js:59)
    at new i (main.js:59)
    at l (main.js:59)
    at a.mounted (main.js:59)
    at Yt (main.js:7)
    at Qi (main.js:7)
    at Object.insert (main.js:7)
    at S (main.js:7)
    at _e.__patch__ (main.js:7)
Vt @ main.js:7

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.