当前位置: 首页>>代码示例>>Python>>正文


Python forms.HiddenInput方法代码示例

本文整理汇总了Python中horizon.forms.HiddenInput方法的典型用法代码示例。如果您正苦于以下问题:Python forms.HiddenInput方法的具体用法?Python forms.HiddenInput怎么用?Python forms.HiddenInput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在horizon.forms的用法示例。


在下文中一共展示了forms.HiddenInput方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: populate_network_choices

# 需要导入模块: from horizon import forms [as 别名]
# 或者: from horizon.forms import HiddenInput [as 别名]
def populate_network_choices(self, request):
        network_list = []
        try:
            if api.base.is_service_enabled(request, 'network'):
                tenant_id = self.request.user.tenant_id
                networks = api.neutron.network_list_for_tenant(request,
                                                               tenant_id)
                network_list = [(network.id, network.name_or_id)
                                for network in networks]
            else:
                self.fields['network'].widget = forms.HiddenInput()
        except exceptions.ServiceCatalogException:
            network_list = []
            redirect = reverse('horizon:project:database_clusters:index')
            exceptions.handle(request,
                              _('Unable to retrieve networks.'),
                              redirect=redirect)
        return network_list 
开发者ID:openstack,项目名称:trove-dashboard,代码行数:20,代码来源:forms.py

示例2: __init__

# 需要导入模块: from horizon import forms [as 别名]
# 或者: from horizon.forms import HiddenInput [as 别名]
def __init__(self, request, *args, **kwargs):
        super(self.__class__, self).__init__(request, *args, **kwargs)
        # populate share_id
        share_id = kwargs.get('initial', {}).get('share_id', [])
        self.fields['share_id'] = forms.CharField(
            widget=forms.HiddenInput(), initial=share_id) 
开发者ID:openstack,项目名称:manila-ui,代码行数:8,代码来源:forms.py

示例3: __init__

# 需要导入模块: from horizon import forms [as 别名]
# 或者: from horizon.forms import HiddenInput [as 别名]
def __init__(self, request, *args, **kwargs):
        super(CreateReplicaForm, self).__init__(request, *args, **kwargs)

        # populate share_id
        share_id = kwargs.get('initial', {}).get('share_id', [])
        self.fields['share_id'] = forms.CharField(widget=forms.HiddenInput(),
                                                  initial=share_id)

        availability_zones = manila.availability_zone_list(request)
        self.fields['availability_zone'].choices = (
            [(az.name, az.name) for az in availability_zones]) 
开发者ID:openstack,项目名称:manila-ui,代码行数:13,代码来源:forms.py

示例4: __init__

# 需要导入模块: from horizon import forms [as 别名]
# 或者: from horizon.forms import HiddenInput [as 别名]
def __init__(self, request, *args, **kwargs):
        super(self.__class__, self).__init__(request, *args, **kwargs)
        # populate share_group_id
        sg_id = kwargs.get('initial', {}).get('share_group_id', [])
        self.fields['share_group_id'] = forms.CharField(
            widget=forms.HiddenInput(), initial=sg_id) 
开发者ID:openstack,项目名称:manila-ui,代码行数:8,代码来源:forms.py

示例5: __init__

# 需要导入模块: from horizon import forms [as 别名]
# 或者: from horizon.forms import HiddenInput [as 别名]
def __init__(self, request, context, *args, **kwargs):
        super(UpdateDefaultShareQuotasAction, self).__init__(
            request, context, *args, **kwargs)
        disabled_quotas = context['disabled_quotas']
        for field in disabled_quotas:
            if field in self.fields:
                self.fields[field].required = False
                self.fields[field].widget = forms.HiddenInput() 
开发者ID:openstack,项目名称:manila-ui,代码行数:10,代码来源:workflows.py

示例6: __init__

# 需要导入模块: from horizon import forms [as 别名]
# 或者: from horizon.forms import HiddenInput [as 别名]
def __init__(self, request, context, *args, **kwargs):
        super(AddRouterParametersInfoAction, self).__init__(
            request, context, *args, **kwargs)
        if 'with_parameters' in context:
            self.fields['with_parameters'] = forms.BooleanField(
                initial=context['with_parameters'],
                required=False,
                widget=forms.HiddenInput()
            ) 
开发者ID:openstack,项目名称:networking-bgpvpn,代码行数:11,代码来源:workflows.py

示例7: _hide_file_source_type

# 需要导入模块: from horizon import forms [as 别名]
# 或者: from horizon.forms import HiddenInput [as 别名]
def _hide_file_source_type(self):
        self.fields['image_file'].widget = HiddenInput()
        source_type = self.fields['source_type']
        source_type.choices = [choice for choice in source_type.choices
                               if choice[0] != 'file']
        if len(source_type.choices) == 1:
            source_type.widget = HiddenInput() 
开发者ID:CiscoSystems,项目名称:avos,代码行数:9,代码来源:forms.py

示例8: _hide_url_source_type

# 需要导入模块: from horizon import forms [as 别名]
# 或者: from horizon.forms import HiddenInput [as 别名]
def _hide_url_source_type(self):
        self.fields['copy_from'].widget = HiddenInput()
        source_type = self.fields['source_type']
        source_type.choices = [choice for choice in source_type.choices
                               if choice[0] != 'url']
        if len(source_type.choices) == 1:
            source_type.widget = HiddenInput() 
开发者ID:CiscoSystems,项目名称:avos,代码行数:9,代码来源:forms.py

示例9: _hide_is_public

# 需要导入模块: from horizon import forms [as 别名]
# 或者: from horizon.forms import HiddenInput [as 别名]
def _hide_is_public(self):
        self.fields['is_public'].widget = HiddenInput()
        self.fields['is_public'].initial = False 
开发者ID:CiscoSystems,项目名称:avos,代码行数:5,代码来源:forms.py

示例10: __init__

# 需要导入模块: from horizon import forms [as 别名]
# 或者: from horizon.forms import HiddenInput [as 别名]
def __init__(self, request, context, *args, **kwargs):
        super(CreateSubnetInfoAction, self).__init__(request, context, *args,
                                                     **kwargs)
        if not getattr(settings, 'OPENSTACK_NEUTRON_NETWORK',
                       {}).get('enable_ipv6', True):
            self.fields['ip_version'].widget = forms.HiddenInput()
            self.fields['ip_version'].initial = 4 
开发者ID:CiscoSystems,项目名称:avos,代码行数:9,代码来源:workflows.py

示例11: __init__

# 需要导入模块: from horizon import forms [as 别名]
# 或者: from horizon.forms import HiddenInput [as 别名]
def __init__(self, request, context, *args, **kwargs):
        super(UpdateSubnetDetailAction, self).__init__(request, context,
                                                       *args, **kwargs)
        # TODO(amotoki): Due to Neutron bug 1362966, we cannot pass "None"
        # to Neutron. It means we cannot set IPv6 two modes to
        # "No option selected".
        # Until bug 1362966 is fixed, we disable this field.
        # if context['ip_version'] != 6:
        #     self.fields['ipv6_modes'].widget = forms.HiddenInput()
        #     self.fields['ipv6_modes'].required = False
        self.fields['ipv6_modes'].widget = forms.HiddenInput()
        self.fields['ipv6_modes'].required = False 
开发者ID:CiscoSystems,项目名称:avos,代码行数:14,代码来源:workflows.py

示例12: build_node_group_fields

# 需要导入模块: from horizon import forms [as 别名]
# 或者: from horizon.forms import HiddenInput [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

示例13: __init__

# 需要导入模块: from horizon import forms [as 别名]
# 或者: from horizon.forms import HiddenInput [as 别名]
def __init__(self, request, *args, **kwargs):
        super(GeneralConfigAction, self).__init__(request, *args, **kwargs)
        plugin, hadoop_version = whelpers.\
            get_plugin_and_hadoop_version(request)

        self.fields["plugin_name"] = forms.CharField(
            widget=forms.HiddenInput(),
            initial=plugin
        )
        self.fields["hadoop_version"] = forms.CharField(
            widget=forms.HiddenInput(),
            initial=hadoop_version
        ) 
开发者ID:CiscoSystems,项目名称:avos,代码行数:15,代码来源:create.py

示例14: __init__

# 需要导入模块: from horizon import forms [as 别名]
# 或者: from horizon.forms import HiddenInput [as 别名]
def __init__(self, request, *args, **kwargs):
        super(JobExecutionGeneralConfigAction, self).__init__(request,
                                                              *args,
                                                              **kwargs)

        if request.REQUEST.get("job_id", None) is None:
            self.fields["job"] = forms.ChoiceField(
                label=_("Job"))
            self.fields["job"].choices = self.populate_job_choices(request)
        else:
            self.fields["job"] = forms.CharField(
                widget=forms.HiddenInput(),
                initial=request.REQUEST.get("job_id", None)) 
开发者ID:CiscoSystems,项目名称:avos,代码行数:15,代码来源:launch.py

示例15: __init__

# 需要导入模块: from horizon import forms [as 别名]
# 或者: from horizon.forms import HiddenInput [as 别名]
def __init__(self, request, context, *args, **kwargs):
        self._init_images_cache()
        self.request = request
        self.context = context
        super(SetInstanceDetailsAction, self).__init__(
            request, context, *args, **kwargs)

        # Hide the device field if the hypervisor doesn't support it.
        if not nova.can_set_mount_point():
            self.fields['device_name'].widget = forms.widgets.HiddenInput()

        source_type_choices = [
            ('', _("Select source")),
            ("image_id", _("Boot from image")),
            ("instance_snapshot_id", _("Boot from snapshot")),
        ]
        if base.is_service_enabled(request, 'volume'):
            source_type_choices.append(("volume_id", _("Boot from volume")))

            try:
                if api.nova.extension_supported("BlockDeviceMappingV2Boot",
                                                request):
                    source_type_choices.append(
                        ("volume_image_id",
                         _("Boot from image (creates a new volume)")))
            except Exception:
                exceptions.handle(request, _('Unable to retrieve extensions '
                                             'information.'))

            source_type_choices.append(
                ("volume_snapshot_id",
                 _("Boot from volume snapshot (creates a new volume)")))
        self.fields['source_type'].choices = source_type_choices 
开发者ID:CiscoSystems,项目名称:avos,代码行数:35,代码来源:create_instance.py


注:本文中的horizon.forms.HiddenInput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。