profile: Add choice field.

Fixes part of #8878
This commit is contained in:
Umair Khan
2018-04-08 12:50:05 +05:00
committed by Tim Abbott
parent 4ea3e8003a
commit cf2f6b38dd
10 changed files with 280 additions and 29 deletions

View File

@@ -1,4 +1,4 @@
from typing import TypeVar, Callable, Optional, List, Dict, Union
from typing import TypeVar, Callable, Optional, List, Dict, Union, Tuple, Any
from django.http import HttpResponse
ViewFuncT = TypeVar('ViewFuncT', bound=Callable[..., HttpResponse])
@@ -6,6 +6,14 @@ 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]]
ProfileDataElement = Dict[str, Union[int, float, Optional[str]]]
ProfileData = List[ProfileDataElement]
FieldElement = Tuple[int, str, Validator, Callable[[Any], Any]]
ExtendedFieldElement = Tuple[int, str, ExtendedValidator, Callable[[Any], Any]]
FieldTypeData = List[Union[FieldElement, ExtendedFieldElement]]
ProfileFieldData = Dict[str, Dict[str, str]]