A Django Management Command for displaying details about your project's models.
Warning: This project is still very new. Expect to see proper testing and an example app demonstrating the command soon.
When working with large projects or when returning to a code base after some time away, it can be challenging to remember all of the fields and methods associated with your models. This command makes it easy to see:
This package takes the original
list_model_info command I wrote for django-extensions to a whole new level. I attempted to simplify some aspects of configuration, while increasing the overall amount of information provided.
The beautiful interface is thanks to
The full documentation will (soon) be at https://django-model-info.readthedocs.io.
pip install django-model-info
Add it to your `INSTALLED_APPS`:
INSTALLED_APPS = ( ... 'django_model_info.apps.DjangoModelInfoConfig', ... )
Run the management command:
>>> python manage.py model_info
An example of the resulting output can be seen here. This example shows the most verbose (level 3) details for a single model.
You can customize the output in a number of ways.
Verbosity levels adjust the amount of information displayed to the console, and is set with the
Note: The default verbosity in
django-model-info is 2
From the command-line:
>>> python manage.py model_info --v 0 >>> python manage.py model_info --verbosity 0
You can specify a different default verbosity value in your settings file.
MODEL_INFO_VERBOSITY = 1
By default, all models within your project are processed and displayed. For large projects, this can result in an enormous output. If you want to limit output to a subset of models, you can use the
--filter argument, providing one or more of the following:
If Django is unable to find provided entries, a message will be written to the console, and the remaining models will be processed and displayed.
From the command-line, here is an example that processes all models in the
auth apps, and also the
>>> python manage.py model_info --f myapp otherapp.SpecificModel auth >>> python manage.py model_info --filter myapp otherapp.SpecificModel auth
You can specify a list of default apps and models to process in your settings file. Using the command-line example names above:
MODEL_INFO_FILTER = ["myapp", "otherapp.SpecificModel", "auth"]
django-model-info can optionally export the console output to an html or text file. The extension of the provided filename must be
>>> python manage.py model_info -e myfilename.html >>> python manage.py model_info --export myfilename.html
source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install tox (myenv) $ tox
Tools used in rendering this package: