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


Python forms.BoundField方法代码示例

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


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

示例1: css_class

# 需要导入模块: from django.forms import forms [as 别名]
# 或者: from django.forms.forms import BoundField [as 别名]
def css_class(field):
    if isinstance(field, BoundField):
        field = field.field
    return field.widget.__class__.__name__.lower() 
开发者ID:dulacp,项目名称:django-accounting,代码行数:6,代码来源:form_filters.py

示例2: is_disabled

# 需要导入模块: from django.forms import forms [as 别名]
# 或者: from django.forms.forms import BoundField [as 别名]
def is_disabled(field):
    if isinstance(field, BoundField):
        field = field.field
    return 'disabled' in field.widget.attrs 
开发者ID:dulacp,项目名称:django-accounting,代码行数:6,代码来源:form_filters.py

示例3: is_readonly

# 需要导入模块: from django.forms import forms [as 别名]
# 或者: from django.forms.forms import BoundField [as 别名]
def is_readonly(field):
    if isinstance(field, BoundField):
        field = field.field
    return ('readonly' in field.widget.attrs and
        field.widget.attrs.get('readonly') is True) 
开发者ID:dulacp,项目名称:django-accounting,代码行数:7,代码来源:form_filters.py

示例4: value

# 需要导入模块: from django.forms import forms [as 别名]
# 或者: from django.forms.forms import BoundField [as 别名]
def value(self):
        """
        Returns the form/formset for this BoundField. This is passed into the
        call for ``self.widget.render`` in the ``as_widget`` method.
        """
        return self.form.get_composite_field_value(self.name)

    # label_tag, no changes required
    # auto_id, no changes required
    # id_for_label, no changes required 
开发者ID:gregmuellegger,项目名称:django-superform,代码行数:12,代码来源:boundfield.py

示例5: test_it_iterates_over_form_fields

# 需要导入模块: from django.forms import forms [as 别名]
# 或者: from django.forms.forms import BoundField [as 别名]
def test_it_iterates_over_form_fields(self):
        form = AccountForm()
        composite_bf = form['nested_form']
        for nested_bf in composite_bf:
            self.assertTrue(isinstance(nested_bf, BoundField))
            self.assertEqual(nested_bf.name, 'name') 
开发者ID:gregmuellegger,项目名称:django-superform,代码行数:8,代码来源:test_boundfield.py

示例6: test_it_allows_key_access_to_form_fields

# 需要导入模块: from django.forms import forms [as 别名]
# 或者: from django.forms.forms import BoundField [as 别名]
def test_it_allows_key_access_to_form_fields(self):
        form = AccountForm()
        composite_f = form['nested_form']
        nested_bf = composite_f['name']
        self.assertTrue(isinstance(nested_bf, BoundField))
        self.assertEqual(nested_bf.name, 'name') 
开发者ID:gregmuellegger,项目名称:django-superform,代码行数:8,代码来源:test_boundfield.py

示例7: as_bootstrap

# 需要导入模块: from django.forms import forms [as 别名]
# 或者: from django.forms.forms import BoundField [as 别名]
def as_bootstrap(form_or_field, layout='vertical,false'):
    """
    Render a field or a form according to Bootstrap guidelines
    """
    params = split(layout, ",")
    layout = str(params[0]).lower()

    try:
        bootstrap_float = str(params[1]).lower() == "float"
    except IndexError:
        bootstrap_float = False

    if isinstance(form_or_field, BaseForm):
        return render_to_string("bootstrap_toolkit/form.html", context={
                'form': form_or_field,
                'layout': layout,
                'float': bootstrap_float,
            }
        )
    elif isinstance(form_or_field, BoundField):
        return render_to_string("bootstrap_toolkit/field.html", context={
                'field': form_or_field,
                'layout': layout,
                'float': bootstrap_float,
            }
        )
    else:
        # Display the default
        return settings.TEMPLATE_STRING_IF_INVALID 
开发者ID:mediafactory,项目名称:yats,代码行数:31,代码来源:bootstrap_toolkit.py


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