Skip to content

Some related managers not getting set up #969

@aleksanb

Description

@aleksanb

See discussion in #902 as well.

I still have most related managers missing after the latest upgrades to the type checker code.

The patch we used to have to apply to an older version of django-mypy was this one: HyreAS@2ec7384.

But i'm not quite sure as to how i would apply this to the current state of the code.

Some related managers do get set up, so it seems like django-mypy just gives up at a certain point and stops adding more related managers.

Our models are on the form

class MyModel(SomeMixin, SomeAbstractClassThatItselfInheritsFromModelsModel):
mode_fields = ...

I'll try to create a repro, but haven't had any luck making a reduced test case actually fail on ci before.

Update: the repro does not fail: #967 :(

This is a dump of what i get with some extra logging added:

no manager <ManyToOneRel: hyre__payment.salesorderrow> django.db.models.manager.RelatedManager TypeInfo(
  Name(django.db.models.manager.RelatedManager)
  Bases(django.db.models.manager.Manager[_T`1])
  Mro(django.db.models.manager.RelatedManager, django.db.models.manager.Manager, django.db.models.manager.BaseManager, builtins.object)
  Names(
    add
    clear
    related_val (builtins.tuple[builtins.int, ...])
    remove
    set))

When adding logging here:

bilde

Unsure where to go from here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions