Create models definitions document from your django project. This project help the documentation related to Django models.
- Add "modelsdoc" to your INSTALLED_APPS setting like this
INSTALLED_APPS = ( ... 'modelsdoc', )
- Run python manage.py listing_models to listing model definition
- You can see the results of executing the command to tests/models.py.
You can pass specify app name. Listing only the specified app.
$ python manage.py listing_models --app polls
It writes the results to the specified file.
$ python manage.py listing_models --output sample.rst
You can choice output format. rst (reStructuredText) or md (Markdown). Default format is rst.
$ python manage.py listing_models --format md
You can specify the apps and change the order.
# output only models of poll MODELSDOC_APPS = (polls,)
You can specify the field value and change the order.
MODELSDOC_DISPLAY_FIELDS = ( ('Fullname', 'verbose_name'), ('Name', 'name'), ('Type', 'db_type'), ('PK', 'primary_key'), ('Unique', 'unique'), ('Index', 'db_index'), ('Null/Blank', 'null_blank'), ('Comment', 'comment'), )
# TODO more documented
MODELSDOC_MODEL_OPTIONS = ( 'unique_together', 'index_together', 'ordering', 'permissions', 'get_latest_by', 'order_with_respect_to', 'db_tablespace', 'abstract', 'swappable', 'select_on_save', 'default_permissions', 'default_related_name' )
# TODO more documented
MODELSDOC_OUTPUT_TEMPLATE = 'modelsdoc/models' MODELSDOC_OUTPUT_FORMAT = 'rst' # default format MODELSDOC_MODEL_WRAPPER = 'modelsdoc.wrappers.ModelWrapper' MODELSDOC_FIELD_WRAPPER = 'modelsdoc.wrappers.FieldWrapper' MODELSDOC_INCLUDE_AUTO_CREATED = True
Django.1.5 | Django1.6 | Django1.7 | Django1.8 | Django1.9 | Django1.10 | Django1.11 | Django2.0 | |
Python 2.7 | ◯ | ◯ | ◯ | ◯ | ◯ | ◯ | ◯ | |
PyPy | ◯ | ◯ | ◯ | ◯ | ◯ | ◯ | ◯ | |
Python 3.3 | ◯ | ◯ | ||||||
Python 3.4 | ◯ | ◯ | ◯ | ◯ | ◯ | ◯ | ||
Python 3.5 | ◯ | ◯ | ◯ | ◯ | ◯ | |||
Python 3.6 | ◯ | ◯ | ◯ | ◯ | ◯ |
MIT Licence. See the LICENSE file for specific terms.
- tell-k
- wanshot
- Add models.yaml template file.
- Add Support YAML format.
- Fix Set section length dynamically. Thanks to wanshot
- Add Support Django2.0
- Add Support Django1.11 and Python 3.6
- Add Support Django1.10
- Add Support Python3.5 and Django1.9
- Fixed bug. When print models, linebreak is ignored.
- Add ManyToManyField's info on "listing_models" results.
- Fixed bug. install test code.
- Add new option "MODELSDOC_INCLUDE_AUTO_CREATED"
- Bug fixed. Not include output templates.
- First release