sphinx-doc/sphinxcontrib-django

Fields of django.forms.ModelForm not added

Closed this issue · 0 comments

Form fields of forms which e.g. inherit from django.forms.ModelForm are not added to the docstring lines.
This is because in docstrings.py:118 only sub-classes of django.forms.Form are modified by _add_form_fields(). However, the inheritance path for model forms is:

django.forms.BaseForm ➡️ django.forms.models.BaseModelForm ➡️ django.forms.models.ModelForm

The corresponding test_add_form_fields does not catch this problem, because the test calls _add_form_fields() directly, whereas in the apidoc generation, improve_model_docstring() is called, which in turn calls _improve_class_docs() which contains the faulty check.