def make_field(name, Type, NoEcho, Default, Description, AllowedValues=None, **kwargs): """Create a form field using the parameters from a Heat template.""" label = utils.de_camel_case(name) Widget = django.forms.TextInput attrs = {} widget_kwargs = {} if Default == 'unset': attrs['placeholder'] = _("auto-generate") if Type == 'String': Field = django.forms.CharField elif Type == 'Integer': Field = django.forms.IntegerField else: raise ValueError("Unsupported parameter type in Heat template.") if NoEcho == 'true': Widget = django.forms.PasswordInput widget_kwargs['render_value'] = True if AllowedValues is not None: return django.forms.ChoiceField(initial=Default, choices=[ (value, value) for value in AllowedValues ], help_text=Description, required=False, label=label) return Field(widget=Widget(attrs=attrs, **widget_kwargs), initial=Default, help_text=Description, required=False, label=label)
def make_field(name, Type, NoEcho, Default, Description, AllowedValues=None, **kwargs): """Create a form field using the parameters from a Heat template.""" label = utils.de_camel_case(name) Widget = django.forms.TextInput attrs = {} widget_kwargs = {} if Default == 'unset': attrs['placeholder'] = _("auto-generate") if Type == 'Json': # TODO(lsmola) this should eventually be a textarea Field = django.forms.CharField else: # TODO(lsmola) we should use Horizon code for generating of the form. # There it should have list of all supported types according to Heat # specification. Field = django.forms.CharField if NoEcho == 'true': Widget = django.forms.PasswordInput widget_kwargs['render_value'] = True if AllowedValues is not None: return django.forms.ChoiceField(initial=Default, choices=[ (value, value) for value in AllowedValues ], help_text=Description, required=False, label=label) return Field(widget=Widget(attrs=attrs, **widget_kwargs), initial=Default, help_text=Description, required=False, label=label)
def get_configuration_data(self): overcloud = self.tab_group.kwargs['overcloud'] return [(utils.de_camel_case(key), value) for key, value in overcloud.stack.parameters.items()]
def get_configuration_data(self): plan = self.tab_group.kwargs['plan'] return [(utils.de_camel_case(key), value) for key, value in plan.stack.parameters.items()]