Thanks to visit codestin.com
Credit goes to github.com

Skip to content

graph_models style per app #1848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 11, 2025
Merged

graph_models style per app #1848

merged 6 commits into from
Apr 11, 2025

Conversation

ahmad88me
Copy link
Contributor

Idea

Style the generated model per app.

use case

Imagine you're working on a Django project composed of two distinct applications, namely 'app1' and 'app2'. These applications are interconnected, with models in each app having relationships not only within the same app but also across the two apps. To effectively visualise these intricate relationships, you're aiming to generate a comprehensive graph model. This graph will not only illustrate the internal model structures within each individual app but will also clearly depict the inter-app model relationships. The goal is to have a single, unified graphical representation that vividly differentiates the models of 'app1' and 'app2', while simultaneously showcasing the connections between them. Such a visual tool would be invaluable for understanding the complex architecture of your Django project at a glance.

How to use it

You can either have a .app-style.json or you can specify the style file using the --app-style option. It takes a path to the style file. The style file is a json file which has the app name as the key and the style as the value. Here is a sample one:

{
  "app1": {"bg": "#341b56"},
  "django.contrib.auth": {"bg": "#561b4c"},
  "app2":{"bg": "#1b3956"}
}

Further, I updated the django style to support the background change. So in the future, this can easily be extended to more styles (e.g., color, font, ..., etc.)

@trbs
Copy link
Member

trbs commented Apr 6, 2025

Thanks for the update. It looks like the PR now removes django_extensions/__init__.py entirely ?

And sorry with the move to pyproject.toml and ruff graph_models.py changed..

@ahmad88me
Copy link
Contributor Author

@trbs no worries πŸ˜‰ .. I added the __init__ and resolved the conflicts.

@ahmad88me
Copy link
Contributor Author

@trbs resolved the new conflicts and fix the lint

@trbs trbs merged commit 7e978d2 into django-extensions:main Apr 11, 2025
10 of 12 checks passed
@ulgens
Copy link
Contributor

ulgens commented Apr 11, 2025

@ahmad88me Is it possible to update https://django-extensions.readthedocs.io/en/latest/graph_models.html#graph-models too? Currently, there is no info in the docs about this new option.

@trbs
Copy link
Member

trbs commented Apr 11, 2025

@ahmad88me Is it possible to update https://django-extensions.readthedocs.io/en/latest/graph_models.html#graph-models too? Currently, there is no info in the docs about this new option.

good catch πŸ˜„ yes please submit a new PR for updated docs, thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants