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


Python fields.BooleanField方法代碼示例

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


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

示例1: add_fields

# 需要導入模塊: from django.forms import fields [as 別名]
# 或者: from django.forms.fields import BooleanField [as 別名]
def add_fields(self, form, index):
        """A hook for adding extra fields on to each form instance."""
        if self.can_order:
            # Only pre-fill the ordering field for initial forms.
            if index is not None and index < self.initial_form_count():
                form.fields[ORDERING_FIELD_NAME] = IntegerField(label=_('Order'), initial=index + 1, required=False)
            else:
                form.fields[ORDERING_FIELD_NAME] = IntegerField(label=_('Order'), required=False)
        if self.can_delete:
            form.fields[DELETION_FIELD_NAME] = BooleanField(label=_('Delete'), required=False) 
開發者ID:lanbing510,項目名稱:GTDWeb,代碼行數:12,代碼來源:formsets.py

示例2: test_formfield_uses_specified_form_class

# 需要導入模塊: from django.forms import fields [as 別名]
# 或者: from django.forms.fields import BooleanField [as 別名]
def test_formfield_uses_specified_form_class(self):
        text_field = self.family_member._meta.get_field('last_name')
        form_field = text_field.formfield(form_class=fields.BooleanField)
        self.assertTrue(isinstance(form_field, fields.BooleanField)) 
開發者ID:r4fek,項目名稱:django-cassandra-engine,代碼行數:6,代碼來源:test_django_cassandra_models.py

示例3: is_boolean

# 需要導入模塊: from django.forms import fields [as 別名]
# 或者: from django.forms.fields import BooleanField [as 別名]
def is_boolean(field):
    if isinstance(field.field, NullBooleanField):
        return False
    if isinstance(field.field, BooleanField):
        return True
    return False 
開發者ID:MagiCircles,項目名稱:SchoolIdolAPI,代碼行數:8,代碼來源:mod.py

示例4: add_fields

# 需要導入模塊: from django.forms import fields [as 別名]
# 或者: from django.forms.fields import BooleanField [as 別名]
def add_fields(self, form, index):
        """A hook for adding extra fields on to each form instance."""
        if self.can_order:
            # Only pre-fill the ordering field for initial forms.
            if index is not None and index < self.initial_form_count():
                form.fields[ORDERING_FIELD_NAME] = IntegerField(label=_('Order'), initial=index+1, required=False)
            else:
                form.fields[ORDERING_FIELD_NAME] = IntegerField(label=_('Order'), required=False)
        if self.can_delete:
            form.fields[DELETION_FIELD_NAME] = BooleanField(label=_('Delete'), required=False) 
開發者ID:blackye,項目名稱:luscan-devel,代碼行數:12,代碼來源:formsets.py


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