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

Add display name to field choices #63

Open mfosterw opened 7 months ago

mfosterw commented 7 months ago

Motivation

Right now when documenting a field with choices, the values of those choices are all that is included. This is frustrating because usually the display name of the choice documents what it means.

Proposed Solution

Add display names to choices documentation, i.e. change

f"* ``{key}``" if key != "" else "* ``''`` (Empty string)"
for key, value in field.choices[:choices_limit]

to

f"* ``{key}: {value}``" if key != "" else "* ``''`` (Empty string)"
for key, value in field.choices[:choices_limit]

in attributes.get_field_details (or something along those lines).