【发布时间】:2016-11-04 22:20:33
【问题描述】:
我在我的 Django 项目中使用 Google Style Python Docstrings like in this Example。 当我创建一个类并在文档字符串中使用属性表示法时,Pycharm 总是说 - “未解析的引用”。
class Post(models.Model):
"""
Class for posts.
Attributes:
title(str): Post title.
"""
title = models.CharField(max_length=120)
我知道 PyCharm 看不到 self 的 title 和 def __init__() 函数并编写此错误,但在 Django 中,我从未见过将 def __init__() 用于从 models 继承的类。
我该怎么办?这是我的错误还是 PyCharm 在这种情况下看不到上下文?我应该使用def __init__() 或其他方式还是以其他方式编写文档?
【问题讨论】:
-
您可以忽略 Django 的此类错误或在 youtrack 中创建问题以支持此功能。我猜它没有在 pycharm 专业版中实现。
标签: python django python-3.x pycharm docstring