Skip to main content

Improve the Sphinx autodoc for Django classes.

Project description

GitHub Workflow Status PyPi Code coverage Black Code Style GitHub license Documentation Status

logo

sphinxcontrib-django2

This is a sphinx extension which improves the documentation of Django apps.

Features

Improvements for the output of Sphinx’s autodoc for Django classes:

  • List all model and form fields as class parameters

  • Improve model field representations

  • Link related and reverse related fields to the referenced class

  • Hide irrelevant runtime information like declared_fieldsets, fieldsets and Meta from classes

  • Add information about autogenerated methods

  • Fix intersphinx mappings to Django modules

  • Custom text roles to cross-reference the documentations of Django (:setting:, :templatetag:, :templatefilter:, :fieldlookup:) and Sphinx (:event:, :confval:)

This is a fork of sphinxcontrib-django, which seems to be no longer maintained.

Installation

Install the package via pip:

pip install sphinxcontrib-django2

Configuration

Add the following to your Sphinx config file conf.py:

# Add source directory to sys.path
sys.path.insert(0, os.path.abspath("../src"))

# Add sphinxcontrib_django2 to installed extensions
extensions = [
    "sphinxcontrib_django2",
]

# Configure the path to the Django settings module
django_settings = "myapp.settings"

Optionally, you can include the table names of your models in their docstrings with:

# Include the database table names of Django models
django_show_db_tables = True

Contributing

Pull requests are always welcome!

You can install all requirements of the development setup with the extras dev, test, doc and optional:

python3 -m venv .venv
source .venv/bin/activate
pip install -e .[dev,test,doc,optional]
pre-commit install

Run the tests and generate the coverage report with:

coverage run
coverage html

Build the documentation with:

cd docs
make html

The documentation is automatically deployed to Read the Docs.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinxcontrib-django2-1.2.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

sphinxcontrib_django2-1.2-py2.py3-none-any.whl (20.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file sphinxcontrib-django2-1.2.tar.gz.

File metadata

  • Download URL: sphinxcontrib-django2-1.2.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for sphinxcontrib-django2-1.2.tar.gz
Algorithm Hash digest
SHA256 ae4d8ce892ce21e802f99b433c80a5df514e0169b23fb5b74f2254f33a5ce93c
MD5 76a209364127f4de8a37a027ee6c8a77
BLAKE2b-256 da7cc6b9e3665acaa39e973b8e8a562ed5944e975fd28570399f8f2b14e57ae3

See more details on using hashes here.

File details

Details for the file sphinxcontrib_django2-1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: sphinxcontrib_django2-1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for sphinxcontrib_django2-1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d8f88a4bf8b3d307dc4d9149df58b111712fa5c3c36ce3a4b1c369315d7d0879
MD5 1dc0482c5bec0a955176c9847190af18
BLAKE2b-256 a7ccc6f83ae426d69c27dea975af54866f9063cc63a6ac571e1126f27f64eb9e

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