Skip to content

Add support for Django models #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 25, 2021
Merged

Add support for Django models #101

merged 4 commits into from
Apr 25, 2021

Conversation

mRokita
Copy link
Contributor

@mRokita mRokita commented Apr 21, 2021

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
Copy link
Contributor Author

mRokita commented Apr 21, 2021

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

A few questions related to Django support:

  • Is it possible to make mkdocstrings ignore show_if_no_docstrings: true for Django's "Meta" class without changing anything in mkdocstrings?
  • It would like to add some more information, like the to argument of a ForeignKey field, is there some nice place for that?

@pawamoy
Copy link
Member

pawamoy commented Apr 21, 2021

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.

Copy link
Member

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's looking good 🙂
Just a few questions.

@pawamoy pawamoy self-assigned this Apr 21, 2021
@mRokita
Copy link
Contributor Author

mRokita commented Apr 21, 2021

[...] 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
Copy link
Contributor Author

mRokita commented Apr 21, 2021

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

Copy link
Member

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@pawamoy pawamoy merged commit 6416a05 into mkdocstrings:master Apr 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants