本文整理汇总了Python中crispy_forms.layout.Submit方法的典型用法代码示例。如果您正苦于以下问题:Python layout.Submit方法的具体用法?Python layout.Submit怎么用?Python layout.Submit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类crispy_forms.layout
的用法示例。
在下文中一共展示了layout.Submit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_form
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Submit [as 别名]
def get_form(self):
form = super().get_form()
form.fields['facility'].widget = forms.HiddenInput()
form.fields['observation_id'].widget = forms.HiddenInput()
if self.request.method == 'GET':
target_id = self.request.GET.get('target_id')
elif self.request.method == 'POST':
target_id = self.request.POST.get('target_id')
cancel_url = reverse('home')
if target_id:
cancel_url = reverse('tom_targets:detail', kwargs={'pk': target_id})
form.helper.layout = Layout(
HTML('''<p>An observation record already exists in your TOM for this combination of observation ID,
facility, and target. Are you sure you want to create this record?</p>'''),
'target_id',
'facility',
'observation_id',
'confirm',
FormActions(
Submit('confirm', 'Confirm'),
HTML(f'<a class="btn btn-outline-primary" href={cancel_url}>Cancel</a>')
)
)
return form
示例2: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Submit [as 别名]
def __init__(self, *args, **kwargs):
super(ActionItemForm, self).__init__(*args, **kwargs)
self.helper = FormHelper(self)
self.helper.layout = Layout(
Row(
Column(css_class='form-group col-md-3 col-xs-4'),
Column('due_date', css_class='form-group col-md-3 col-xs-4'),
Column('instruction', css_class='form-group col-md-3 col-xs-4'),
css_class='form-row'
),
Row(
Column(css_class='form-group col-md-3 col-xs-4'),
Column('comments', css_class='form-group col-md-6 col-xs-6')
),
CustomCheckbox('priority'),
Row(
Column(Submit('submit', 'Submit'),
css_class='formgroup col-md-offset-3 col-xs-offset-4')
)
)
self.fields['instruction'].queryset = models.ActionInstruction.objects.filter(
active=True)
示例3: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Submit [as 别名]
def __init__(self, *args, **kwargs):
referral_location_qs = kwargs.pop('referral_location_qs', None)
super(PatientContactForm, self).__init__(*args, **kwargs)
if referral_location_qs is not None:
self.fields['appointment_location'].queryset = referral_location_qs
self.helper = FormHelper(self)
self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-lg-2'
self.helper.field_class = 'col-lg-8'
self.helper.add_input(Submit(
self.SUCCESSFUL_REFERRAL,
'Save & mark successful referral',
css_class='btn btn-success'))
self.helper.add_input(Submit(
self.REQUEST_FOLLOWUP,
'Save & request future followup',
css_class='btn btn-info'))
self.helper.add_input(Submit(
self.UNSUCCESSFUL_REFERRAL,
'Save & do not follow up again',
css_class='btn btn-danger btn-sm'))
示例4: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Submit [as 别名]
def __init__(self, *args, **kwargs):
super(DemographicsForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_method = 'post'
self.helper.layout = Layout(
Fieldset('Medical',
'has_insurance',
'ER_visit_last_year',
'last_date_physician_visit',
'chronic_condition'),
Fieldset('Social',
'lives_alone',
'dependents',
'resource_access',
'transportation'),
Fieldset('Employment',
'currently_employed',
'education_level',
'work_status',
'annual_income')
)
self.helper.add_input(Submit('submit', 'Submit'))
示例5: form
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Submit [as 别名]
def form(self):
form = super(FilterSet, self).form
if compat.is_crispy():
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Submit
layout_components = list(form.fields.keys()) + [
Submit('', _('Submit'), css_class='btn-default'),
]
helper = FormHelper()
helper.form_method = 'GET'
helper.template_pack = 'bootstrap3'
helper.layout = Layout(*layout_components)
form.helper = helper
return form
示例6: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Submit [as 别名]
def __init__(self, *args, **kwargs):
super(SuggestionForm, self).__init__(*args, **kwargs)
# Translators: This labels a textfield where users can enter the name of the potential partner they'll suggest
self.fields["suggested_company_name"].label = _("Name of the potential partner")
# Translators: This labels a textfield where users can enter the description of the potential partner they'll suggest
self.fields["description"].label = _("Description")
# Translators: This labels a textfield where users can enter the website URL of the potential partner they'll suggest
self.fields["company_url"].label = _("Website")
# @TODO: This sort of gets repeated in PartnerSuggestionView.
# We could probably be factored out to a common place for DRYness.
self.helper = FormHelper()
self.helper.form_tag = False
self.helper.form_class = "form-horizontal"
self.helper.label_class = "col-lg-3"
self.helper.field_class = "col-lg-7"
self.helper.layout = Layout(
"suggested_company_name",
"description",
"company_url",
"next",
# Translators: This labels a button which users click to submit their suggestion.
Submit("submit", _("Submit"), css_class="center-block"),
)
示例7: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Submit [as 别名]
def __init__(self, *args, **kwargs):
super(ReportIncidentForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_action = reverse('tracker:report-incident')
self.helper.render_hidden_fields = True
self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-lg-2'
self.helper.field_class = 'col-lg-10'
self.helper.add_input(Submit('submit', 'Report', css_class='btn-lg btn-block'))
示例8: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Submit [as 别名]
def __init__(self, *args, **kwargs):
super(EmailLoginForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_method = 'post'
self.helper.add_input(Submit('submit', _('Login')))
示例9: get_layout
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Submit [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
示例10: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Submit [as 别名]
def __init__(self, text=_("Submit"), **kwargs):
super(SubmitButton, self).__init__(name='post', value=text, **kwargs)
示例11: button_layout
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Submit [as 别名]
def button_layout(self):
target_id = self.initial.get('target_id')
return ButtonHolder(
Submit('submit', 'Submit'),
HTML(f'''<a class="btn btn-outline-primary" href={{% url 'tom_targets:detail' {target_id} %}}>
Back</a>''')
)
示例12: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Submit [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.add_input(Submit('submit', 'Submit'))
self.common_layout = Layout('facility', 'strategy_name')
示例13: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Submit [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.add_input(Submit('create-latex', 'Create Table'))
# if self.is_bound:
# self.helper.add_input(Submit('save-latex', 'Save Latex Config'))
self.common_layout = Layout('model_pk', 'model_name', 'table_header', 'table_footer', 'template')
示例14: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Submit [as 别名]
def __init__(self, *args, **kwargs):
self.user = kwargs.pop('user', None)
super(TopicForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.add_input(Submit('submit', _('Submit')))
示例15: __init__
# 需要导入模块: from crispy_forms import layout [as 别名]
# 或者: from crispy_forms.layout import Submit [as 别名]
def __init__(self, *args, **kwargs):
super(AllauthSignupForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_method = 'post'
self.helper.add_input(Submit('submit', 'Sign Up', css_class='btn btn-lg btn-success btn-block'))