You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from __future__ import annotations
from django.db import models
class Author(models.Model):
name: str = models.CharField(max_length=200)
def func(self) -> str:
return self.name
class Book(models.Model):
author: Author = models.ForeignKey(Author, on_delete=models.CASCADE)
def author_name(self):
print(self.author.name)
return self.author.func()
I get this error 15: E1101: Instance of 'ForeignKey' has no 'func' member (no-member)
Be aware that there are type hints in the model foreign key fields so that my IDE can recognize the instance field types.
Curiously pylint complains about the function func but not about the field name
pylint==2.17.4
astroid==2.15.5
Python 3.11.3
thanks
The text was updated successfully, but these errors were encountered:
I get this error
15: E1101: Instance of 'ForeignKey' has no 'func' member (no-member)
Be aware that there are type hints in the model foreign key fields so that my IDE can recognize the instance field types.
Curiously pylint complains about the function
func
but not about the fieldname
thanks
The text was updated successfully, but these errors were encountered: