Is there a way to make pyright 'recognize' django related name fields? #9170
tiredsapiens
started this conversation in
General
Replies: 1 comment
-
Django is using techniques to inject new attributes into a class without declaring them. In other words, it's using highly dynamic behaviors of the Python language that cannot be expressed using the static type system. I don't know much about Django, but you may be able to add dummy class variable annotations, like this. class A(models.Model):
id = models.IntegerField()
fk_B: str You might want to post your question to a forum with more Django users. They might have experience using Django with the Python static type system. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
take for example a code snippet like this
is there a way to make this work other than writing
#type ignore
every time i use a related name in django?(which i do alot)Beta Was this translation helpful? Give feedback.
All reactions