Update utils.py to handle SecretStr field type as str with password and load_from_db attributes (#2005)

* chore: Update utils.py to handle SecretStr field type as str with password and load_from_db attributes

* Update utils.py to handle SecretStr field type as str with password and load_from_db attributes
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-05-30 12:02:54 -07:00 • committed by GitHub
commit eb68558905
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 16 additions and 11 deletions

View file

@ -159,6 +159,11 @@ def add_new_custom_field(
if field_type == "bool" and field_value is None:
field_value = False
if field_type == "SecretStr":
field_config["password"] = True
field_config["load_from_db"] = True
field_config["input_types"] = ["Text"]
# If options is a list, then it's a dropdown
# If options is None, then it's a list of strings
is_list = isinstance(field_config.get("options"), list)