0

I'm documenting a huge Django project and would like to have an option to hide autogenerated Django stuff like below. Is it something I have to "deal with" or is there a setting I haven't found yet?

I document with:

.. automodule:: module.models
    :members:

and get things like below, which would be good if I had those overriden, but they're not:

exception DoesNotExist

exception MultipleObjectsReturned

save(*args, **kwargs):...
mzjn
  • 48,958
  • 13
  • 128
  • 248
Archarachne
  • 235
  • 1
  • 5
  • 18

1 Answers1

1

See documentation of automodule directive and its options, including exclude-members:

The directives supporting member documentation also have a exclude-members option that can be used to exclude single member names from documentation, if all members are to be documented.

Update for Sphinx >= 1.8

HT to @nerdoc in comments.

autodoc_default_flags is deprecated in Sphinx 1.8.

It has been moved into a new setting autodoc_default_options as an option.

autodoc_default_options = {
    "exclude-members": "__weakref__",
}
Steve Piercy
  • 13,693
  • 1
  • 44
  • 57
  • Thanks! `:exlude-members: DoesNotExist, MultipleObjectsReturned` worked miracles. – Archarachne Apr 28 '20 at 11:49
  • 1
    `autodoc_default_flags` is deprecated since v1.8 andIntegrated into [autodoc_default_options](https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autodoc_default_options) – nerdoc May 20 '22 at 20:56