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


Python widgets.HiddenInput方法代码示例

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


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

示例1: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import HiddenInput [as 别名]
def __init__(self, *args, **kwargs):
        super(BootsrapForm, self).__init__(*args, **kwargs)
        for field in self.fields.values():
            # Only tweak the field if it will be displayed
            if not isinstance(field.widget, widgets.HiddenInput):
                attrs = {}
                if (
                    isinstance(field.widget, (widgets.Input, widgets.Select, widgets.Textarea)) and
                    not isinstance(field.widget, (widgets.CheckboxInput,))
                ):
                    attrs['class'] = "form-control"
                if isinstance(field.widget, (widgets.Input, widgets.Textarea)) and field.label:
                    attrs["placeholder"] = field.label
                if field.required:
                    attrs["required"] = "required"
                field.widget.attrs.update(attrs) 
开发者ID:nitmir,项目名称:django-cas-server,代码行数:18,代码来源:forms.py

示例2: test_edit_attachments_cannot_set_mount_point

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import HiddenInput [as 别名]
def test_edit_attachments_cannot_set_mount_point(self):

        volume = self.cinder_volumes.first()
        servers = [s for s in self.servers.list()
                   if s.tenant_id == self.request.user.tenant_id]

        cinder.volume_get(IsA(http.HttpRequest), volume.id).AndReturn(volume)
        api.nova.server_list(IsA(http.HttpRequest)).AndReturn([servers, False])
        self.mox.ReplayAll()

        url = reverse('horizon:project:volumes:volumes:attach',
                      args=[volume.id])
        res = self.client.get(url)
        # Assert the device field is hidden.
        form = res.context['form']
        self.assertTrue(isinstance(form.fields['device'].widget,
                                   widgets.HiddenInput)) 
开发者ID:CiscoSystems,项目名称:avos,代码行数:19,代码来源:tests.py

示例3: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import HiddenInput [as 别名]
def __init__(self, *args, **kwargs):
        self.base_fields[TOTAL_FORM_COUNT] = IntegerField(widget=HiddenInput)
        self.base_fields[INITIAL_FORM_COUNT] = IntegerField(widget=HiddenInput)
        # MIN_NUM_FORM_COUNT and MAX_NUM_FORM_COUNT are output with the rest of
        # the management form, but only for the convenience of client-side
        # code. The POST value of them returned from the client is not checked.
        self.base_fields[MIN_NUM_FORM_COUNT] = IntegerField(required=False, widget=HiddenInput)
        self.base_fields[MAX_NUM_FORM_COUNT] = IntegerField(required=False, widget=HiddenInput)
        super(ManagementForm, self).__init__(*args, **kwargs) 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:11,代码来源:formsets.py

示例4: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import HiddenInput [as 别名]
def __init__(self, *args, **kwargs):
        self.base_fields[TOTAL_FORM_COUNT] = IntegerField(widget=HiddenInput)
        self.base_fields[INITIAL_FORM_COUNT] = IntegerField(widget=HiddenInput)
        # MIN_NUM_FORM_COUNT and MAX_NUM_FORM_COUNT are output with the rest of
        # the management form, but only for the convenience of client-side
        # code. The POST value of them returned from the client is not checked.
        self.base_fields[MIN_NUM_FORM_COUNT] = IntegerField(required=False, widget=HiddenInput)
        self.base_fields[MAX_NUM_FORM_COUNT] = IntegerField(required=False, widget=HiddenInput)
        super().__init__(*args, **kwargs) 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:11,代码来源:formsets.py

示例5: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import HiddenInput [as 别名]
def __init__(self, *args, **kwargs):
        self.base_fields[TOTAL_FORM_COUNT] = IntegerField(widget=HiddenInput)
        self.base_fields[INITIAL_FORM_COUNT] = IntegerField(widget=HiddenInput)
        self.base_fields[MAX_NUM_FORM_COUNT] = IntegerField(required=False, widget=HiddenInput)
        super(ManagementForm, self).__init__(*args, **kwargs) 
开发者ID:blackye,项目名称:luscan-devel,代码行数:7,代码来源:formsets.py

示例6: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import HiddenInput [as 别名]
def __init__(self, *args, **kwargs):
        super(MeterModelCreateForm, self).__init__(*args, **kwargs)
        meter_id = self.initial.get('meter_id')
        self.meter_hidden = False
        if meter_id:
            try:
                Meter.objects.get(meter_id=meter_id)
                self.fields['meter_id'].widget = HiddenInput()
                self.meter_hidden = True
            except Meter.DoesNotExist:
                logger.error('CalcMeterSavingsForm: Meter not found with id = %s', meter_id)
                self.initial.pop('meter_id') 
开发者ID:opentaps,项目名称:opentaps_seas,代码行数:14,代码来源:forms.py

示例7: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import HiddenInput [as 别名]
def __init__(self, *args, request=None, allow_clicked_position=False, **kwargs):
        self.request = request
        super().__init__(*args, **kwargs)

        GraphNode = self.request.changeset.wrap_model('GraphNode')
        graph_node_qs = GraphNode.objects.all()
        self.fields['active_node'] = ModelChoiceField(graph_node_qs, widget=HiddenInput(), required=False)
        self.fields['clicked_node'] = ModelChoiceField(graph_node_qs, widget=HiddenInput(), required=False)

        if allow_clicked_position:
            self.fields['clicked_position'] = CharField(widget=HiddenInput(), required=False)

        Space = self.request.changeset.wrap_model('Space')
        space_qs = Space.objects.all()
        self.fields['goto_space'] = ModelChoiceField(space_qs, widget=HiddenInput(), required=False) 
开发者ID:c3nav,项目名称:c3nav,代码行数:17,代码来源:forms.py

示例8: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import HiddenInput [as 别名]
def __init__(self, attrs=None):
        widgets = (HiddenInput(attrs=attrs), HiddenInput(attrs=attrs))
        super(VATINWidget, self).__init__(widgets, attrs) 
开发者ID:codingjoe,项目名称:django-vies,代码行数:5,代码来源:widgets.py

示例9: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import HiddenInput [as 别名]
def __init__(self, *args, **kwargs):
        self.user = kwargs.pop('user')
        self.group = kwargs.pop('group')
        read_only = kwargs.pop('read_only') if 'read_only' in kwargs else False
        super().__init__(*args, **kwargs)
        self.fields['collection'].queryset = self.fields['collection'].queryset.filter(
            owner_id=self.user.id
        )
        if read_only:
            self.fields['collection'].widget = HiddenInput()
            self.fields['collection'].widget.attrs['readonly'] = read_only 
开发者ID:harvard-vpal,项目名称:bridge-adaptivity,代码行数:13,代码来源:forms.py

示例10: test_launch_form_instance_device_name_hidden

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import HiddenInput [as 别名]
def test_launch_form_instance_device_name_hidden(self):
        self._test_launch_form_instance_show_device_name(
            u'', widgets.HiddenInput, {
                'name': 'device_name', 'value': '',
                'attrs': {'id': 'id_device_name'}}
        ) 
开发者ID:CiscoSystems,项目名称:avos,代码行数:8,代码来源:tests.py


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