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

Allow foreign keys to be strings #3

Closed wesleykendall closed 6 years ago

wesleykendall commented 6 years ago

Hello, awesome project! I encountered a bug when 'auth.User' was provided as a foreign key. It's valid to have a string path as a Foreign Key, and this change just prints the string path.

I'm not sure of other places in the code that would need to be updated to handle this case. Maybe we can try to update those too?

vdboor commented 6 years ago

Thanks a lot! Glad you like it.

vdboor commented 6 years ago

I'm not sure of other places in the code that would need to be updated to handle this case. Maybe we can try to update those too?

One change would be to use apps.get_model() to fetch the actual class, and print that instead.