mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
This commit modifies FIELD_TYPE_DATA dict in `CustomProfileField` model to store keyword of field types. And create new dict FIELD_TYPE_CHOICES_DICT to store all field type information by field type keyword, i.e. id, name. This is preparatory commit to remove all static use of field types in frontend and access field type with keyword instead of display name.
22 lines
928 B
Python
22 lines
928 B
Python
from typing import TypeVar, Callable, Optional, List, Dict, Union, Tuple, Any
|
|
from django.http import HttpResponse
|
|
|
|
ViewFuncT = TypeVar('ViewFuncT', bound=Callable[..., HttpResponse])
|
|
|
|
# See zerver/lib/validator.py for more details of Validators,
|
|
# including many examples
|
|
Validator = Callable[[str, object], Optional[str]]
|
|
ExtendedValidator = Callable[[str, str, object], Optional[str]]
|
|
RealmUserValidator = Callable[[int, List[int], bool], Optional[str]]
|
|
|
|
ProfileDataElement = Dict[str, Union[int, float, Optional[str]]]
|
|
ProfileData = List[ProfileDataElement]
|
|
|
|
FieldElement = Tuple[int, str, Validator, Callable[[Any], Any], str]
|
|
ExtendedFieldElement = Tuple[int, str, ExtendedValidator, Callable[[Any], Any], str]
|
|
UserFieldElement = Tuple[int, str, RealmUserValidator, Callable[[Any], Any], str]
|
|
|
|
FieldTypeData = List[Union[FieldElement, ExtendedFieldElement, UserFieldElement]]
|
|
|
|
ProfileFieldData = Dict[str, Dict[str, str]]
|