Eugene Nagorny
Eugene Nagorny

Reputation: 1666

pyCharm Django error

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?

Upvotes: 3

Views: 2415

Answers (1)

vartec
vartec

Reputation: 134551

Make sure that you have line

from django.db import models

And that Django package is actually in your Python path as set in PyCharm.

Upvotes: 4

Related Questions