diff --git a/muranodashboard/dynamic_ui/fields.py b/muranodashboard/dynamic_ui/fields.py index f3dc2800e..614859d08 100644 --- a/muranodashboard/dynamic_ui/fields.py +++ b/muranodashboard/dynamic_ui/fields.py @@ -350,11 +350,18 @@ class FlavorChoiceField(ChoiceField): choices.sort(key=lambda e: e[1]) self.choices = choices - # Search through selected flavors - for flavor_name, flavor_name in self.choices: - if 'medium' in flavor_name: - self.initial = flavor_name - break + if kwargs.get('form'): + kwargs_form_flavor = kwargs["form"].fields.get('flavor') + else: + kwargs_form_flavor = None + if kwargs_form_flavor: + self.initial = kwargs["form"]["flavor"].value() + else: + # Search through selected flavors + for flavor_name, flavor_name in self.choices: + if 'medium' in flavor_name: + self.initial = flavor_name + break class KeyPairChoiceField(DynamicChoiceField): diff --git a/releasenotes/notes/bug-1650406-4e4a3bdcfcc5718a.yaml b/releasenotes/notes/bug-1650406-4e4a3bdcfcc5718a.yaml new file mode 100644 index 000000000..89f63a3d0 --- /dev/null +++ b/releasenotes/notes/bug-1650406-4e4a3bdcfcc5718a.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Flavor field will show the initial value by default.