當前位置: 首頁>>代碼示例>>Python>>正文


Python forms.TextInput方法代碼示例

本文整理匯總了Python中horizon.forms.TextInput方法的典型用法代碼示例。如果您正苦於以下問題:Python forms.TextInput方法的具體用法?Python forms.TextInput怎麽用?Python forms.TextInput使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在horizon.forms的用法示例。


在下文中一共展示了forms.TextInput方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from horizon import forms [as 別名]
# 或者: from horizon.forms import TextInput [as 別名]
def __init__(self, request, *args, **kwargs):
        super(UpdateForm, self).__init__(request, *args, **kwargs)
        self.dvr_allowed = api.neutron.get_feature_permission(self.request,
                                                              "dvr", "update")
        if not self.dvr_allowed:
            del self.fields['mode']
        elif kwargs.get('initial', {}).get('mode') == 'distributed':
            # Neutron supports only changing from centralized to
            # distributed now.
            mode_choices = [('distributed', _('Distributed'))]
            self.fields['mode'].widget = forms.TextInput(attrs={'readonly':
                                                                'readonly'})
            self.fields['mode'].choices = mode_choices
        else:
            mode_choices = [('centralized', _('Centralized')),
                            ('distributed', _('Distributed'))]
            self.fields['mode'].choices = mode_choices

        # TODO(amotoki): Due to Neutron Bug 1378525, Neutron disables
        # PUT operation. It will be fixed in Kilo cycle.
        # self.ha_allowed = api.neutron.get_feature_permission(
        #     self.request, "l3-ha", "update")
        self.ha_allowed = False
        if not self.ha_allowed:
            del self.fields['ha'] 
開發者ID:CiscoSystems,項目名稱:avos,代碼行數:27,代碼來源:forms.py

示例2: __init__

# 需要導入模塊: from horizon import forms [as 別名]
# 或者: from horizon.forms import TextInput [as 別名]
def __init__(self, *args, **kwargs):
        super(UpdateObject, self).__init__(*args, **kwargs)
        self.fields['name'].widget = forms.TextInput(
            attrs={"readonly": "readonly"})
        self.fields['name'].help_text = None 
開發者ID:CiscoSystems,項目名稱:avos,代碼行數:7,代碼來源:forms.py

示例3: build_control

# 需要導入模塊: from horizon import forms [as 別名]
# 或者: from horizon.forms import TextInput [as 別名]
def build_control(parameter):
    attrs = {"priority": parameter.priority,
             "placeholder": parameter.default_value}
    if parameter.param_type == "string":
        return forms.CharField(
            widget=forms.TextInput(attrs=attrs),
            label=parameter.name,
            required=(parameter.required and
                      parameter.default_value is None),
            help_text=parameter.description,
            initial=parameter.initial_value)

    if parameter.param_type == "int":
        return forms.IntegerField(
            widget=forms.TextInput(attrs=attrs),
            label=parameter.name,
            required=parameter.required,
            help_text=parameter.description,
            initial=parameter.initial_value)

    elif parameter.param_type == "bool":
        return forms.BooleanField(
            widget=forms.CheckboxInput(attrs=attrs),
            label=parameter.name,
            required=False,
            initial=parameter.initial_value,
            help_text=parameter.description)

    elif parameter.param_type == "dropdown":
        return forms.ChoiceField(
            widget=forms.Select(attrs=attrs),
            label=parameter.name,
            required=parameter.required,
            choices=parameter.choices,
            help_text=parameter.description) 
開發者ID:CiscoSystems,項目名稱:avos,代碼行數:37,代碼來源:workflow_helpers.py

示例4: build_node_group_fields

# 需要導入模塊: from horizon import forms [as 別名]
# 或者: from horizon.forms import TextInput [as 別名]
def build_node_group_fields(action, name, template, count, serialized=None):
    action.fields[name] = forms.CharField(
        label=_("Name"),
        widget=forms.TextInput())

    action.fields[template] = forms.CharField(
        label=_("Node group cluster"),
        widget=forms.HiddenInput())

    action.fields[count] = forms.IntegerField(
        label=_("Count"),
        min_value=0,
        widget=forms.HiddenInput())
    action.fields[serialized] = forms.CharField(
        widget=forms.HiddenInput()) 
開發者ID:CiscoSystems,項目名稱:avos,代碼行數:17,代碼來源:workflow_helpers.py

示例5: __init__

# 需要導入模塊: from horizon import forms [as 別名]
# 或者: from horizon.forms import TextInput [as 別名]
def __init__(self, request, *args, **kwargs):
        super(CreateProjectInfoAction, self).__init__(request,
                                                      *args,
                                                      **kwargs)
        # For keystone V3, display the two fields in read-only
        if keystone.VERSIONS.active >= 3:
            readonlyInput = forms.TextInput(attrs={'readonly': 'readonly'})
            self.fields["domain_id"].widget = readonlyInput
            self.fields["domain_name"].widget = readonlyInput 
開發者ID:CiscoSystems,項目名稱:avos,代碼行數:11,代碼來源:workflows.py

示例6: __init__

# 需要導入模塊: from horizon import forms [as 別名]
# 或者: from horizon.forms import TextInput [as 別名]
def __init__(self, request, *args, **kwargs):
        super(UpdateUserForm, self).__init__(request, *args, **kwargs)

        if api.keystone.keystone_can_edit_user() is False:
            for field in ('name', 'email', 'password', 'confirm_password'):
                self.fields.pop(field)
                # For keystone V3, display the two fields in read-only
        if api.keystone.VERSIONS.active >= 3:
            readonlyInput = forms.TextInput(attrs={'readonly': 'readonly'})
            self.fields["domain_id"].widget = readonlyInput
            self.fields["domain_name"].widget = readonlyInput

    # We have to protect the entire "data" dict because it contains the
    # password and confirm_password strings. 
開發者ID:CiscoSystems,項目名稱:avos,代碼行數:16,代碼來源:forms.py


注:本文中的horizon.forms.TextInput方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。