Merge "Let flavor fields show the default value"

This commit is contained in:
Jenkins 2017-01-19 17:15:00 +00:00 committed by Gerrit Code Review
commit 9dbf6a109b
2 changed files with 16 additions and 5 deletions

View File

@ -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):

View File

@ -0,0 +1,4 @@
---
features:
- |
Flavor field will show the initial value by default.