How flavor choice field or dropdown of create instance UI get populated
1)
https://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py
class SetInstanceDetailsAction(workflows.Action):
flavor = forms.ChoiceField(label=_("Flavor"), help_text=_("Size of image to launch."))
def populate_flavor_choices(self, request, context):
----
return flavor_list
2)
https://github.com/openstack/horizon/blob/master/horizon/workflows/base.py
class Action(forms.Form):
def __init__(self, request, context, *args, **kwargs):
self._populate_choices(request, context)
def _populate_choices(self, request, context):
for field_name, bound_field in self.fields.items():
meth = getattr(self, "populate_%s_choices" % field_name, None)
if meth is not None and callable(meth):
bound_field.choices = meth(request, context)
1)
https://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py
class SetInstanceDetailsAction(workflows.Action):
flavor = forms.ChoiceField(label=_("Flavor"), help_text=_("Size of image to launch."))
def populate_flavor_choices(self, request, context):
----
return flavor_list
2)
https://github.com/openstack/horizon/blob/master/horizon/workflows/base.py
class Action(forms.Form):
def __init__(self, request, context, *args, **kwargs):
self._populate_choices(request, context)
def _populate_choices(self, request, context):
for field_name, bound_field in self.fields.items():
meth = getattr(self, "populate_%s_choices" % field_name, None)
if meth is not None and callable(meth):
bound_field.choices = meth(request, context)
No comments:
Post a Comment