I am getting Unresolved attribute reference for inherited methods in my Pycharm Django project.
What I have tried without any luck:
Note: This issue seems to occurred only on inherited methods. When importing classes directly the autocomplete suggestions propagate correctly.
This is not an error. This is simply the linter that can not understand the large amount of meta-programming by Django. Django's models has a lot of magic going on. For example if you define a field foo = models.IntegerField()
, then self.foo
is not the IntegerField
, but the int
for that record.
This meta-programming could probably be understood by a smart linter, but it would take a lot of analysis.
The PyCharm professional edition has a linter that contains some reasoning w.r.t. Django's metaprogramming, although (likely) a lot is hardcoded. There are also tools like pylint-django` that have some understanding of Django.
But there is thus no error, it is just the linter that is confused.