-
Notifications
You must be signed in to change notification settings - Fork 287
-
Throughout my codebase I have a number of related_name relations defined. For most, django-stubs (latest release) seems to be generating the requisite annotations to make MyPy pass, but for certain models the annotation is not being generated. One example of this is a more complicated structure than a simple model to model, foreign key reference, as it uses an abstract base model, eg:
class BaseImage(models.Model):
image = models.ImageField(blank=True)
class FruitImage(BaseImage):
fruit = models.OneToOneField(
Fruit,
related_name="image")
class Fruit(models.Model):
name = models.CharField(max_length=10)
With this particular structure, I am receiving the mypy error "Fruit" has no attribute "image"
Is there anything I need to do to properly annotate reverse relations of this form?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
Please, report this to our tracker: https://github.com/typeddjango/django-stubs
Beta Was this translation helpful? Give feedback.