mkdocstrings / pytkdocs

Load Python objects documentation.
https://mkdocstrings.github.io/pytkdocs
ISC License
50 stars 32 forks source link

Add support for Django models #101

Closed mRokita closed 3 years ago

mRokita commented 3 years ago

That's just basic support for now - supports blank and required attributes.

Looks like it works for my old university project (sorry for Polish verbose_names ;)

obraz

References: #39.

mRokita commented 3 years ago

I've just fixed some minor issues, I think, that it's ready to be merged.

A few questions related to Django support:

pawamoy commented 3 years ago

Hey, thanks for your contribution @mRokita!

Is it possible to make mkdocstrings ignore show_if_no_docstrings: true for Django's "Meta" class without changing anything in mkdocstrings?

I guess it's possible if you override a template and check if the current class is called "Meta" and has a Django model as parent.

It would like to add some more information, like the to argument of a ForeignKey field, is there some nice place for that?

Currently, no, but the plan is to do what is described in this comment (which you already read): serialize arbitrary objects' values.

mRokita commented 3 years ago

[...] the plan is to do what is described in this comment (which you already read): serialize arbitrary objects' values.

That would be a great improvement, any plans on splitting #64 into smaller tasks? I would love to help, but I don't really know where to start.

mRokita commented 3 years ago

Because of what I described here, I replaced _meta.fields with _meta.get_fields and a filter.