From e276812e42f8d12d294cc86e4bb7237915539cb7 Mon Sep 17 00:00:00 2001 From: Mateusz Mandera Date: Mon, 27 Nov 2023 02:02:45 +0100 Subject: [PATCH] models: Create OrgTypeDict for Realm.ORG_TYPES typing. --- zerver/models.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/zerver/models.py b/zerver/models.py index da117fbab7..4392246ba0 100644 --- a/zerver/models.py +++ b/zerver/models.py @@ -295,6 +295,14 @@ def generate_realm_uuid_owner_secret() -> str: return f"zuliprealm_{token}" +class OrgTypeDict(TypedDict): + name: str + id: int + hidden: bool + display_order: int + onboarding_zulip_guide_url: Optional[str] + + class Realm(models.Model): # type: ignore[django-manager-missing] # django-stubs cannot resolve the custom CTEManager yet https://github.com/typeddjango/django-stubs/issues/1023 MAX_REALM_NAME_LENGTH = 40 MAX_REALM_DESCRIPTION_LENGTH = 1000 @@ -554,7 +562,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub first_visible_message_id = models.IntegerField(default=0) # Valid org types - ORG_TYPES: Dict[str, Dict[str, Any]] = { + ORG_TYPES: Dict[str, OrgTypeDict] = { "unspecified": { "name": "Unspecified", "id": 0,