本文整理汇总了Python中crispy_forms.layout.Div方法的典型用法代码示例。如果您正苦于以下问题:Python layout.Div方法的具体用法?Python layout.Div怎么用?Python layout.Div使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类crispy_forms.layout
的用法示例。
在下文中一共展示了layout.Div方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Div [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for field_name in ['groups', 'target_id']:
self.fields.pop(field_name, None)
for field in self.fields:
if field != 'strategy_name':
self.fields[field].required = False
self.helper.layout = Layout(
self.common_layout,
Div(
Div(
'proposal', 'ipp_value', 'filter', 'instrument_type',
css_class='col'
),
Div(
'exposure_count', 'exposure_time', 'max_airmass',
css_class='col'
),
css_class='form-row',
)
)
示例2: layout
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Div [as 别名]
def layout(self):
return Div(
Div('name', 'observation_id'),
Div(
Div('start', css_class='col'),
Div('end', css_class='col'),
css_class='form-row'
),
Div('observation_params')
)
示例3: layout
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Div [as 别名]
def layout(self):
return Div(
Div(
Div(
'name', 'proposal', 'ipp_value', 'observation_mode', 'start', 'end',
css_class='col'
),
Div(
'filter', 'instrument_type', 'exposure_count', 'exposure_time', 'max_airmass',
css_class='col'
),
css_class='form-row',
),
Div(
HTML('<p>Cadence parameters. Leave blank if no cadencing is desired.</p>'),
),
Div(
Div(
'period',
css_class='col'
),
Div(
'jitter',
css_class='col'
),
css_class='form-row'
),
)
示例4: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Div [as 别名]
def __init__(self, *args, **kwargs):
self.helper = FormHelper()
self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-md-2'
self.helper.field_class = 'col-md-8'
self.helper.layout = Layout(*[Div(field, css_class='form-group')
for field in ['user', 'newpassword1', 'newpassword2', 'email']])
self.instance = False
if 'instance' in kwargs.keys():
kwargs.pop('instance')
self.instance = True
super(RegisterForm, self).__init__(*args, **kwargs)
示例5: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Div [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-md-2'
self.helper.field_class = 'col-md-8'
self.helper.layout = Layout(*[Div(field, css_class='form-group') for field in [
'webterminal_detect', 'otp_switch', 'use_tz', 'timezone']])
示例6: layout
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Div [as 别名]
def layout(self):
return Div(
HTML('<big>Observation Parameters</big>'),
HTML('<p>Select the Obsids of one or more templates. <br>'),
HTML('Setting Ready=No will keep the new observation(s) On Hold. <br>'),
HTML('If a value is not set, then the template default is used. <br>'),
HTML('If setting Exptime, then provide a list of values if selecting more than one Obsid.</p>'),
Div(
Div(
'obsid',
css_class='col'
),
Div(
'ready',
css_class='col'
),
Div(
'notetitle',
css_class='col'
),
css_class='form-row'
),
Div(
Div(
'posangle', 'brightness', 'eltype', 'group',
css_class='col'
),
Div(
'exptimes', 'brightness_band', 'elmin', 'window_start',
css_class='col'
),
Div(
'note', 'brightness_system', 'elmax', 'window_duration',
css_class='col'
),
css_class='form-row'
),
HTML('<big>Optional Guide Star Parameters</big>'),
HTML('<p>If any one of Name/RA/Dec is given, then all must be.</p>'),
Div(
Div(
'gstarg', 'gsbrightness', 'gsprobe',
css_class='col'
),
Div(
'gsra', 'gsbrightness_band',
css_class='col'
),
Div(
'gsdec', 'gsbrightness_system',
css_class='col'
),
css_class='form-row',
)
)
示例7: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Div [as 别名]
def __init__(self, request, *args, **kwargs):
self.request = request
super().__init__(*args, **kwargs)
geoposition = self.instance.get_geoposition()
if geoposition:
self.fields["latitude"].initial = geoposition.latitude
self.fields["longitude"].initial = geoposition.longitude
name_field = layout.Field("name", css_class="input-block-level")
description_field = layout.Field(
"description", css_class="input-block-level", rows="3"
)
main_fieldset = layout.Fieldset(_("Main data"), name_field, description_field)
picture_field = layout.Field(
"picture",
data_url=reverse("upload_file"),
template="core/includes/file_upload_field.html",
)
picture_path_field = layout.Field("picture_path")
picture_fieldset = layout.Fieldset(
_("Picture"),
picture_field,
picture_path_field,
title=_("Picture upload"),
css_id="picture_fieldset",
)
street_address_field = layout.Field(
"street_address", css_class="input-block-level"
)
street_address2_field = layout.Field(
"street_address2", css_class="input-block-level"
)
postal_code_field = layout.Field("postal_code", css_class="input-block-level")
city_field = layout.Field("city", css_class="input-block-level")
country_field = layout.Field("country", css_class="input-block-level")
latitude_field = layout.Field("latitude", css_class="input-block-level")
longitude_field = layout.Field("longitude", css_class="input-block-level")
address_fieldset = layout.Fieldset(
_("Address"),
street_address_field,
street_address2_field,
postal_code_field,
city_field,
country_field,
latitude_field,
longitude_field,
)
submit_button = layout.Submit("save", _("Save"))
actions = bootstrap.FormActions(layout.Div(submit_button, css_class="col"))
self.helper = helper.FormHelper()
self.helper.form_action = self.request.path
self.helper.form_method = "POST"
self.helper.attrs = {"noValidate": "noValidate"}
self.helper.layout = layout.Layout(main_fieldset, picture_fieldset, address_fieldset, actions)