server_environment: fix default method not passed

before this commit, default values were not populated
in other environments. The problem was only seen with
data_encryption which save all the values for all the environments.
This commit is contained in:
hparfr 2023-09-25 23:22:28 +02:00
parent 20dc9b9413
commit c35b5d98b4
1 changed files with 7 additions and 1 deletions

View File

@ -401,7 +401,13 @@ class ServerEnvMixin(models.AbstractModel):
base_field_cls = base_field.__class__
field_args = base_field.args.copy()
field_args.pop("_sequence", None)
field_args.update({"sparse": "server_env_defaults", "automatic": True})
field_args.update(
{
"sparse": "server_env_defaults",
"automatic": True,
"default": base_field.default,
}
)
if hasattr(base_field, "selection"):
field_args["selection"] = base_field.selection