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

use field_name for DeferredAttributes to be version agnostic #22

Closed v-erena closed 4 years ago

v-erena commented 4 years ago

As Django docs suggest, you can just use the field name of a model field to return the field instance. https://docs.djangoproject.com/en/3.0/ref/models/meta/#django.db.models.options.Options.get_field

This makes the attribute doc retrieval for a DeferredAttribute easier as it is Django version agnostic.

Note: not quite sure whether I instantiated the DeferredAttribute correctly in the new test. Please have an eye on that.

codecov-io commented 4 years ago

Codecov Report

Merging #22 into master will increase coverage by 5.39%. The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #22      +/-   ##
==========================================
+ Coverage   57.28%   62.67%   +5.39%     
==========================================
  Files           6        6              
  Lines         206      217      +11     
==========================================
+ Hits          118      136      +18     
+ Misses         88       81       -7
Impacted Files Coverage Δ
sphinxcontrib_django/docstrings.py 46.97% <100%> (+5.25%) :arrow_up:
sphinxcontrib_django/tests/test_docstrings.py 96.15% <84.61%> (-3.85%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 364293f...3850df5. Read the comment docs.

vdboor commented 4 years ago

Thanks a lot!

I've released this as v0.5.1