# matches/models.py
class MatchGroup(models.Model):
members = models.ManyToManyField(
to="users.User",
related_name="match_groups",
)
# users/models.py
class User(auth_models.AbstractBaseUser, auth_models.PermissionsMixin):
# Details here should not be relevant.
...
When I look up a group by its users like so
user_ids = (1, 2)
group = MatchGroup.objects.get(members=user_ids)
I get the following error from mypy:
Incompatible type for lookup 'members': (got "tuple[int, int]", expected "User | int | None") [misc]
How is that should be
Passing an iterable of integers to the lookup should be ok and not generate errors, because Django can deal with it.
Bug report
What's wrong
I have the following models
When I look up a group by its users like so
I get the following error from mypy:
How is that should be
Passing an iterable of integers to the lookup should be ok and not generate errors, because Django can deal with it.
System information
python
version: 3.11django
version: 5.0.6mypy
version: 1.10.0django-stubs
version: 5.0.2django-stubs-ext
version: 5.0.2