Skip to content
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

generating DB comments from __doc__ special variable #6

Closed
Koldar opened this issue Jan 2, 2021 · 2 comments
Closed

generating DB comments from __doc__ special variable #6

Koldar opened this issue Jan 2, 2021 · 2 comments

Comments

@Koldar
Copy link

Koldar commented Jan 2, 2021

  • Django Db Comments version: 0.2.2
  • Django version: 3.1
  • Python version: 3.8
  • Operating System: Windows 10 Pro

Description

This is a feature request: it would be possible to fetch the database comment not only from help_text and from verbose_name but also from the special __doc__ element attached to the column field? For instance, it would be great to do something like:

name = models.CharField(name='name', max_length=255, null=False)
"""
Name of the my awesome entity
"""

In this way we could fetch the help not only in the database, but also from the content assist (e.g., in PyCharm IDE) as well.

What do you think?

@vanadium23
Copy link
Owner

I'll check if a django field has a __doc__ property in it.

@vanadium23
Copy link
Owner

I've checked __doc__ property on provided example:

ipdb> field
<django.db.models.fields.CharField: name>
ipdb> field.__doc__
ipdb> 

But django doesn't store __doc__ as property of Field and library need to parse AST for it, and so autodiscover every models' source code. It's a bit overhead for processing, and I've decided not to implement the feature.

Anyway, thank you for the suggestion.

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

No branches or pull requests

2 participants