pyCharm Django 错误
我正在使用 PyCharm。在 models.py 中,我有这样的模型:
class TaricCode(models.Model):
code = models.IntegerField(primary_key=True, verbose_name="Code")
description = models.CharField(max_length=256, blank=True, verbose_name="Description")
但在views.py 中,当我编写:
tc = TaricCode.objects.all()
objects
时,下划线为错误“未解析的属性引用”,并且代码完整不适用于它。当我运行应用程序时它可以工作。 怎么了?
I am using PyCharm. And in models.py I have such model:
class TaricCode(models.Model):
code = models.IntegerField(primary_key=True, verbose_name="Code")
description = models.CharField(max_length=256, blank=True, verbose_name="Description")
But in views.py when I write:
tc = TaricCode.objects.all()
objects
is underlined as error "unresolved attribute reference" and code complete doesn't work for it. And when I run application it works.
What's wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保您有一行
And that Django package 实际上位于 PyCharm 中设置的 Python 路径中。
Make sure that you have line
And that Django package is actually in your Python path as set in PyCharm.