本文整理匯總了Python中wagtail.core.blocks.BooleanBlock方法的典型用法代碼示例。如果您正苦於以下問題:Python blocks.BooleanBlock方法的具體用法?Python blocks.BooleanBlock怎麽用?Python blocks.BooleanBlock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wagtail.core.blocks
的用法示例。
在下文中一共展示了blocks.BooleanBlock方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_form_block
# 需要導入模塊: from wagtail.core import blocks [as 別名]
# 或者: from wagtail.core.blocks import BooleanBlock [as 別名]
def get_form_block(self):
"""The StreamField StructBlock.
Override this to provide additional fields in the StreamField.
:return: The ``wagtail.core.blocks.StructBlock`` to be used in the StreamField
"""
return blocks.StructBlock(
[
("label", blocks.CharBlock()),
("help_text", blocks.CharBlock(required=False)),
("required", blocks.BooleanBlock(required=False)),
("default_value", blocks.CharBlock(required=False)),
],
icon=self.icon,
label=self.label,
)
示例2: get_form_block
# 需要導入模塊: from wagtail.core import blocks [as 別名]
# 或者: from wagtail.core.blocks import BooleanBlock [as 別名]
def get_form_block(self):
return blocks.StructBlock([
('label', blocks.CharBlock()),
('help_text', blocks.CharBlock(required=False)),
('required', blocks.BooleanBlock(required=False)),
('regex', blocks.ChoiceBlock(choices=self.get_regex_choices())),
('error_message', blocks.CharBlock()),
('default_value', blocks.CharBlock(required=False)),
], icon=self.icon, label=self.label)
示例3: get_form_block
# 需要導入模塊: from wagtail.core import blocks [as 別名]
# 或者: from wagtail.core.blocks import BooleanBlock [as 別名]
def get_form_block(self):
return blocks.StructBlock(
[
("label", blocks.CharBlock()),
("help_text", blocks.CharBlock(required=False)),
("required", blocks.BooleanBlock(required=False)),
("empty_label", blocks.CharBlock(required=False)),
("choices", blocks.ListBlock(blocks.CharBlock(label="Option"))),
],
icon=self.icon,
label=self.label,
)