Why am I seeing this warning for a class which is a subclass of models.Model (Foo is defined as class Foo(models.Model))? This is wherever I use Foo.objects.filter(...).
Responding to request for more detail with a simplified example:
# ------ models.py ---------
from django.db import models
class Foo(models.Model):
pass
# ------ views.py ---------
from models import Foo
inquiry = Foo.objects.filter(...) # PyCharm gives warning for objects here
...
PyCharm gives no warnings for the import statements in either file.
Is your pycharm version community or professional? If your pycharm is community, maybe it needs a pluggin to support django. If your pycharm is professional, make sure that in: Preferences > Languages&Frameworks > Django > Enable Django Support
the option is chosen. Here is the image:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With