Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unresolved attribute reference 'objects' for class '' in PyCharm

I use community pycharm and the version of python is 3.6.1, django is 1.11.1. This warning has no affect on running, but I cannot use the IDE's auto complete.

like image 726
zhiang.shi Avatar asked May 09 '17 09:05

zhiang.shi


2 Answers

You need to enable Django support. Go to

PyCharm -> Preferences -> Languages & Frameworks -> Django

and then check Enable Django Support

like image 71
vishes_shell Avatar answered Nov 15 '22 03:11

vishes_shell


You can also expose the default model manager explicitly:

from django.db import models

class Foo(models.Model):
    name = models.CharField(max_length=50, primary_key=True)

    objects = models.Manager()
like image 38
Campi Avatar answered Nov 15 '22 02:11

Campi