Skip to main content

Docs generator for Django models

Project description

Generate docs for django models

Generate extensible Markdown documentation for Django models. Developed for cross-team collaboration when iterating on on data model specifications.

User quickstart with an existing Django project

Install into your project requirements (git+https://github.com/jakekara/django-model-docs.git)

Add to the Django settings INSTALLED_APPS.

Generate Markdown documentation YOUR_APP

python manage.py generate-model-docs YOUR_APP

Dev quick start

# set up a virtual env however you like. here's what I like:
python -m venv venv 
. ./venv bin activate

# set up dev stuff
pip install -r requirements.txt

# install the package in editable mode
pip install -e .

# generate docs for model(s) in the demo app
cd demo_django_project
python manage.py generate-model-docs demo_django_app

The output looks like this at the moment:

# `demo_django_app`` app`

_This file was auto-generated Django Model Docs Generator.  Do not edit this file directly._

A demo Django App. Note that this text will be pulled from the app's docstring and used in the default output of `generate-model-docs`.

## `person` model

Person(id, first_name, last_name, shoeStyle)

|    Field   |Description|                                                          Data type                                                         |Nullable|Default|
|------------|-----------|----------------------------------------------------------------------------------------------------------------------------|--------|-------|
|    `id`    |           |                                                        BigAutoField                                                        |  False |   -   |
|`first_name`|           |                                                          CharField                                                         |  False |   -   |
| `last_name`|           |                                                          CharField                                                         |  False |   -   |
| `shoeStyle`|           |CharField<br><br>Choices (stored value : human readable)<br><br>- `LO` : `LOAFER`<br>- `BO` : `BOOT`<br>- `DR` : `DRESS`<br>|  False |   -   |

Tests

Tests need to be run in the context of the demo_django_app.

cd demo_django_project
python manage.py test django-model-docs

To run the test suite against every supported Python version, use the command tox (you must have each Python version available to tox). You should see output like:

  py39: OK (2.44=setup[2.08]+cmd[0.36] seconds)
  py310: OK (2.04=setup[1.75]+cmd[0.30] seconds)
  py311: OK (2.19=setup[1.86]+cmd[0.33] seconds)
  py312: OK (6.02=setup[5.63]+cmd[0.39] seconds)
  congratulations :) (12.72 seconds)

If you're using pyenv to manage versions, you need to run pyenv local 3.9 3.10 3.11 3.12 to make these versions accessible to tox from in the project environment.

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-model-docs-0.0.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

django_model_docs-0.0.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file django-model-docs-0.0.0.tar.gz.

File metadata

  • Download URL: django-model-docs-0.0.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for django-model-docs-0.0.0.tar.gz
Algorithm Hash digest
SHA256 ceba69677307f11f5d520a3615efd62521ede19c76484cb51402b56427bb1d62
MD5 f78ffefda2f5fe4dc0434a14b1fb18c1
BLAKE2b-256 45c5b4753e5482e267f3a3fb42c6c43b3d13d46cbd36b4dbd46a9e6609391bbd

See more details on using hashes here.

File details

Details for the file django_model_docs-0.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_model_docs-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1b366c347c0db97a42104889ad7999dde37cd047ceda73977ffb7ce57607aa05
MD5 508d49b48320fa25950bffdad537b61b
BLAKE2b-256 13e17cf6718d76212c6478c95cb9fc1142aeecfcd7e1bf5b9bf42242ad6e7f05

See more details on using hashes here.

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