sphinx-doc / sphinxcontrib-django

This is a sphinx extension which improves the documentation of Django apps.
https://pypi.org/project/sphinxcontrib-django/
Apache License 2.0
43 stars 25 forks source link

Fields of django.forms.ModelForm not added #27

Closed timobrembeck closed 1 year ago

timobrembeck commented 4 years ago

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 :arrow_right: django.forms.models.BaseModelForm :arrow_right: 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.