resize_instance.py (horizon-18.6.3) | : | resize_instance.py (horizon-18.6.4) | ||
---|---|---|---|---|
skipping to change at line 48 | skipping to change at line 48 | |||
label=_("New Flavor"), | label=_("New Flavor"), | |||
help_text=_("Choose the flavor to launch.")) | help_text=_("Choose the flavor to launch.")) | |||
class Meta(object): | class Meta(object): | |||
name = _("Flavor Choice") | name = _("Flavor Choice") | |||
slug = 'flavor_choice' | slug = 'flavor_choice' | |||
help_text_template = ("project/instances/" | help_text_template = ("project/instances/" | |||
"_flavors_and_quotas.html") | "_flavors_and_quotas.html") | |||
def populate_flavor_choices(self, request, context): | def populate_flavor_choices(self, request, context): | |||
old_flavor_id = context.get('old_flavor_id') | old_flavor_name = context.get('old_flavor_name') | |||
flavors = context.get('flavors').values() | flavors = context.get('flavors').values() | |||
# Remove current flavor from the list of flavor choices | # Remove current flavor from the list of flavor choices | |||
flavors = [flavor for flavor in flavors if flavor.id != old_flavor_id] | flavors = [flavor for flavor in flavors | |||
if flavor.name != old_flavor_name] | ||||
if flavors: | if flavors: | |||
if len(flavors) > 1: | if len(flavors) > 1: | |||
flavors = instance_utils.sort_flavor_list(request, flavors) | flavors = instance_utils.sort_flavor_list(request, flavors) | |||
else: | else: | |||
flavor = flavors[0] | flavor = flavors[0] | |||
flavors = [(flavor.id, flavor.name)] | flavors = [(flavor.id, flavor.name)] | |||
flavors.insert(0, ("", _("Select a New Flavor"))) | flavors.insert(0, ("", _("Select a New Flavor"))) | |||
else: | else: | |||
flavors.insert(0, ("", _("No flavors available"))) | flavors.insert(0, ("", _("No flavors available"))) | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 3 lines changed or added |