當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。