Skip to main content

Its a spicy meatball for serving up fresh hot entity-relationship diagrams straight from your django models.

Project description

Documentation Status travis Code Climate coveralls

Its a spicy meatball for serving up fresh hot entity-relationship diagrams straight from your django models.

Adding spaghetti to your project

Install some spaghetti:

pip install django-spaghetti-and-meatballs

Add "django_spaghetti" to your INSTALLED_APPS setting like this:

INSTALLED_APPS = [
    ...
    'django_spaghetti',
]

Configure your sauce

django-spaghetti-and-meatballs takes a few options set in the SPAGHETTI_SAUCE variable from your projects settings.py file that make it extra spicy:

SPAGHETTI_SAUCE = {
    'apps': ['auth', 'polls'],
    'show_fields': False,
    'exclude': {'auth': ['user']},
}

In the above dictionary, the following settings are used:

  • apps is a list of apps you want to show in the graph. If its not in here it won’t be seen.

  • show_fields is a boolean that states if the field names should be shown in the graph or just in the however over. For small graphs, you can set this to True to show fields as well, but as you get more models it gets messier.

  • exclude is a dictionary where each key is an app_label and the items for that key are model names to hide in the graph.

If its not working as expected make sure your app labels and model names are all lower case.

Serve your plate in your urls file

Once you’ve configured your sauce, make sure you serve up a plate of spaghetti in your urls.py like so:

urlpatterns += patterns('',
    url(r'^plate/', include('django_spaghetti.urls')),
)

A sample platter

Below is an example image showing the connections between models from the django-reversion and django-notifications apps and Django’s built-in auth models.

Colored edges illustrate foreign key relations, with arrows pointing from the defining model to the related model, while gray edges illustrate many-to-many relations. Different colors signify the different Django apps, and when relations link between apps the edges are colored with a gradient.

https://cloud.githubusercontent.com/assets/2173174/9053053/a45e185c-3ab2-11e5-9ea0-89dafb7ac274.png

Hovering over a model, gives a pop-up that lists the following information:

  • model name

  • app label

  • The models docstring

  • A list of every field, with its field type and its help text (if defined). Unique fields have their name underlined.

This was build with the sauce:

SPAGHETTI_SAUCE = {
    'apps': ['auth', 'notifications', 'reversion'],
    'show_fields': False,
}

A complex live-demo

To see a complex example, where django-spaghetti-and-meatballs really shines, checkout the live version built for the Aristotle Metadata Registry

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-spaghetti-and-meatballs-0.3.1.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file django-spaghetti-and-meatballs-0.3.1.tar.gz.

File metadata

  • Download URL: django-spaghetti-and-meatballs-0.3.1.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.8.5 Linux/4.19.104-microsoft-standard

File hashes

Hashes for django-spaghetti-and-meatballs-0.3.1.tar.gz
Algorithm Hash digest
SHA256 cb8812fcd6399b40568cf40a1e33be394688cd9f34831aa6ca9258ff1f28fd13
MD5 f1223c8ca170b934608e496a8efb8d9c
BLAKE2b-256 d6eb45c795aa410dd524a6ac6fe40f2282a79e5906a4f3305f70c670711043e8

See more details on using hashes here.

Provenance

File details

Details for the file django_spaghetti_and_meatballs-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_spaghetti_and_meatballs-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6f8a65edc123150c6909ce7466bc0a1d382b04aea029079964655f9a1ce51ff6
MD5 c51ee31e2363b31e5e8ea0ca4fa4198c
BLAKE2b-256 ae99fbbfd8c5d29e855832e768c3ca63336baac0e3f322a845d8d408efca4202

See more details on using hashes here.

Provenance

Supported by

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