本文整理匯總了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")),
)
)