models: Add type annotation for CTEManager.

mypy_django_plugin cannot resolve the type of the custom manager. We add
a type annotation explicitly to skip the type inferrence.

This fixes the following error:
error: Could not resolve manager type for "zerver.models.UserGroup.objects"  [django-manager-missing]

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
Zixuan James Li
2022-08-10 18:13:00 -04:00
committed by Tim Abbott
parent 95d12749c0
commit 92c4e5b75c

View File

@@ -2132,7 +2132,7 @@ class PasswordTooWeakError(Exception):
class UserGroup(models.Model):
objects = CTEManager()
objects: CTEManager = CTEManager()
id: int = models.AutoField(auto_created=True, primary_key=True, verbose_name="ID")
name: str = models.CharField(max_length=100)
direct_members: Manager = models.ManyToManyField(