beanbag_docutils.sphinx.ext.django_utils

Sphinx extension to add useful Django-related functionality.

This adds some improvements when working with Django-based classes in autodocs, and when referencing Django documentation.

Localized strings using ugettext_lazy() will be turned into actual strings for the documentation, which is useful for forms and models.

Roles are also added for common cross-references.

Setup

To use this, you just need to add the extension in conf.py:

extensions = [
    ...
    'beanbag_docutils.sphinx.ext.django_utils',
    ...
]

Roles

:setting:

Creates and links to references for Django settings (those that live in django.conf.settings).

For example:

.. setting:: MY_SETTING

Settings go here.

And then to reference it: :setting:`MY_SETTING`.

Functions

setup(app)

Set up the Sphinx extension.

beanbag_docutils.sphinx.ext.django_utils.setup(app)

Set up the Sphinx extension.

This registers cross-references and fixes up the lazily-localized strings for display.

Parameters:

app (sphinx.application.Sphinx) – The Sphinx application to listen to events on.