本文整理汇总了Python中crispy_forms.layout.Field方法的典型用法代码示例。如果您正苦于以下问题:Python layout.Field方法的具体用法?Python layout.Field怎么用?Python layout.Field使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类crispy_forms.layout
的用法示例。
在下文中一共展示了layout.Field方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Field [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper(self)
self.helper.layout = Layout(
layout.Fieldset(
'',
layout.Field('recipient', readonly=True),
'subject',
'body',
'referenced_post',
),
bootstrap.FormActions(
Submit('submit', 'Send Message', css_class='btn btn-success'),
)
)
self.helper.form_tag = False
示例2: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Field [as 别名]
def __init__(self, *args, **kwargs):
super(MonsterPieceForm, self).__init__(*args, **kwargs)
self.helper = FormHelper(self)
self.helper.form_class = 'ajax-form'
self.helper.include_media = False
self.helper.layout = Layout(
Field(
'monster',
data_toggle='popover',
data_trigger='focus',
data_container='body',
title='Autocomplete Tips',
data_content="Enter the monster's awakened or unawakened name (either will work). To further narrow results, type the element too. Example: \"Raksha water\" will list water Rakshasa and Su",
),
Field('pieces'),
FormActions(
Submit('save', 'Save', css_class='btn btn-primary'),
Button('cancel', 'Cancel', css_class='btn btn-link', data_dismiss='modal')
),
)
示例3: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Field [as 别名]
def __init__(self, request, *args, **kwargs):
self.request = request
super().__init__(*args, **kwargs)
id_field = layout.Field("id")
language_field = layout.Field("language", css_class="input-block-level")
title_field = layout.Field("title", css_class="input-block-level")
content_field = layout.Field("content", css_class="input-block-level", rows="3")
delete_field = layout.Field("DELETE")
main_fieldset = layout.Fieldset(
_("Main data"),
id_field,
language_field,
title_field,
content_field,
delete_field,
)
self.helper = helper.FormHelper()
self.helper.form_tag = False
self.helper.disable_csrf = True
self.helper.layout = layout.Layout(main_fieldset)
示例4: convert_field
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Field [as 别名]
def convert_field(self, f, counts):
col_class = "col-sm-%d" % int(math.ceil(12 / counts))
if not (isinstance(f, Field) or issubclass(f.__class__, Field)):
f = layout.Field(f)
if f.wrapper_class:
f.wrapper_class += " %s" % col_class
else:
f.wrapper_class = col_class
return f
示例5: get_layout
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Field [as 别名]
def get_layout(self, helper):
items = [Field(x, wrapper_class="form-group") for x in self.fields]
action = FormActions(Submit('submit', _(u'查询')),
css_class="form-group")
items.append(action)
layout = Layout(*items)
return layout
示例6: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Field [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_action = ""
self.helper.form_method = "POST"
self.helper.layout = layout.Layout(
layout.Field("title"),
layout.Field(
"categories",
template="utils/checkbox_multi_select_tree.html"),
bootstrap.FormActions(
layout.Submit("submit", _("Save")),
)
)