diff --git a/apps/assets/const/base.py b/apps/assets/const/base.py index 5aea334d4..338e02bb0 100644 --- a/apps/assets/const/base.py +++ b/apps/assets/const/base.py @@ -69,10 +69,15 @@ class BaseType(TextChoices): choices = protocol.get('choices', []) if choices == '__self__': choices = [tp] - protocols = [ - {'name': name, **settings.get(name, {})} - for name in choices - ] + + protocols = [] + for name in choices: + protocol = {'name': name, **settings.get(name, {})} + setting = protocol.pop('setting', {}) + setting_values = {k: v.get('default', None) for k, v in setting.items()} + protocol['setting'] = setting_values + protocols.append(protocol) + if protocols: protocols[0]['default'] = True return protocols