models: Create OrgTypeDict for Realm.ORG_TYPES typing.

This commit is contained in:
Mateusz Mandera 2023-11-27 02:02:45 +01:00 committed by Tim Abbott
parent 6f2d4f1af2
commit e276812e42
1 changed files with 9 additions and 1 deletions

View File

@ -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,