django-stubs
django-stubs copied to clipboard
Some related managers not getting set up
See discussion in https://github.com/typeddjango/django-stubs/pull/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: https://github.com/HyreAS/django-stubs/commit/2ec73849bf919cbf49550884e89d2314459bb1f7.
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: https://github.com/typeddjango/django-stubs/pull/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:

Unsure where to go from here.