mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
form:BaseChoicesOption: do not declare choices
to allow other related fields to come first in subclasses
This commit is contained in:
parent
d7166bf77f
commit
90aa6b86f1
1 changed files with 3 additions and 2 deletions
|
@ -1317,9 +1317,10 @@ class FileOption(BaseInputOption):
|
||||||
class BaseChoicesOption(BaseInputOption):
|
class BaseChoicesOption(BaseInputOption):
|
||||||
# FIXME probably forbid choices to be None?
|
# FIXME probably forbid choices to be None?
|
||||||
filter: Union[JSExpression, None] = None # filter before choices
|
filter: Union[JSExpression, None] = None # filter before choices
|
||||||
choices: Union[dict[str, Any], list[Any], None]
|
# We do not declare `choices` here to be able to declare other fields before `choices` and acces their values in `choices` validators
|
||||||
|
# choices: Union[dict[str, Any], list[Any], None]
|
||||||
|
|
||||||
@validator("choices", pre=True)
|
@validator("choices", pre=True, check_fields=False)
|
||||||
def parse_comalist_choices(value: Any) -> Union[dict[str, Any], list[Any], None]:
|
def parse_comalist_choices(value: Any) -> Union[dict[str, Any], list[Any], None]:
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
values = [value.strip() for value in value.split(",")]
|
values = [value.strip() for value in value.split(",")]
|
||||||
|
|
Loading…
Add table
Reference in a new issue