本文整理汇总了Python中crispy_forms.helper.FormHelper方法的典型用法代码示例。如果您正苦于以下问题:Python helper.FormHelper方法的具体用法?Python helper.FormHelper怎么用?Python helper.FormHelper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类crispy_forms.helper
的用法示例。
在下文中一共展示了helper.FormHelper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from crispy_forms import helper [as 别名]
# 或者: from crispy_forms.helper import FormHelper [as 别名]
def __init__(self, *args, **kwargs):
self._email_token = kwargs.pop('email_token', None)
self._verification_code = self._email_token.verification_code
super(EmailVerificationForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_id = 'id_form_email_verification'
self.helper.form_action = reverse_lazy('accounts_email_verification', args=(self._email_token.id,))
self.helper.layout = Layout(
Div(
'code',
),
HTML('''<hr class="full">'''),
Div(
Div(
HTML('''<a href="{% url 'accounts_register' %}">
{{ _('Cancel and sign up again') }}</a> '''),
Submit('submit', _('Verify Email address'), css_class='btn-success btn-lg'),
css_class='pull-right'
)
)
)
示例2: __init__
# 需要导入模块: from crispy_forms import helper [as 别名]
# 或者: from crispy_forms.helper import FormHelper [as 别名]
def __init__(self, *args, **kwargs):
super(KeywordCreateForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_id = 'id_form_keywords_create'
self.helper.layout = Layout(
Div(
Div(
'term',
css_class='col-sm-6 col-sm-offset-3'
),
css_class='row'
),
HTML('''<hr class="full">'''),
Div(
Div(
HTML('''<a href="{% url 'keywords_manage' %}">{{ _('Cancel') }}</a> '''),
Submit('submit', _('Save'), css_class='btn-success btn-lg'),
css_class='pull-right'
),
css_class='row',
)
)
示例3: __init__
# 需要导入模块: from crispy_forms import helper [as 别名]
# 或者: from crispy_forms.helper import FormHelper [as 别名]
def __init__(self, *args, **kwargs):
AuthenticationForm.__init__(self, *args, **kwargs)
self.error_messages['invalid_login'] = _(u"Пожалуйста, введите верные имя пользователя / адрес электронной почты и пароль.")
self.fields['username'].label = _(u"Логин / E-mail")
self.helper = FormHelper(self)
self.helper.form_action = '/accounts/login/'
self.helper.label_class = 'col-md-4'
self.helper.field_class = 'col-md-8'
self.helper.layout.append(HTML(u"""<div class="form-group row" style="margin-bottom: 16px;margin-top: -16px;">
<div class="col-md-offset-4 col-md-8">
<a href="{% url "django.contrib.auth.views.password_reset" %}"><small class="text-muted">""" + _(u'Забыли пароль?') + """</small></a>
</div>
</div>
<div class="form-group row">
<div class="col-md-offset-4 col-md-8">
<button type="submit" class="btn btn-secondary">""" + _(u'Войти') + """</button>
<input type="hidden" name="next" value="{{ next }}" />
</div>
</div>"""))
示例4: __init__
# 需要导入模块: from crispy_forms import helper [as 别名]
# 或者: from crispy_forms.helper import FormHelper [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_action = reverse('tom_observations:add-existing')
self.helper.layout = Layout(
'target_id',
'confirm',
Row(
Column(
'facility'
),
Column(
'observation_id'
),
Column(
ButtonHolder(
Submit('submit', 'Add Existing Observation')
)
)
)
)
示例5: __init__
# 需要导入模块: from crispy_forms import helper [as 别名]
# 或者: from crispy_forms.helper import FormHelper [as 别名]
def __init__(self, *args, **kwargs):
self.user = kwargs.pop("user")
kwargs.update(
{
"initial": {
"contact_name": self.user.get_full_name,
"contact_email": self.user.email,
}
}
)
super(SponsorApplicationForm, self).__init__(*args, **kwargs)
self.helper = FormHelper(self)
self.helper.field_class = "col-sm-10 col-lg-10"
self.helper.form_tag = False
self.helper.label_class = "col-sm-2 col-lg-2"
self.helper.layout = Layout(
"name",
"external_url",
"contact_name",
"contact_email",
"level",
)
示例6: __init__
# 需要导入模块: from crispy_forms import helper [as 别名]
# 或者: from crispy_forms.helper import FormHelper [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)
示例7: __init__
# 需要导入模块: from crispy_forms import helper [as 别名]
# 或者: from crispy_forms.helper import FormHelper [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'))
示例8: __init__
# 需要导入模块: from crispy_forms import helper [as 别名]
# 或者: from crispy_forms.helper import FormHelper [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'))
示例9: __init__
# 需要导入模块: from crispy_forms import helper [as 别名]
# 或者: from crispy_forms.helper import FormHelper [as 别名]
def __init__(self, *args, **kwargs):
super(MessageRecipientForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-md-3'
self.helper.field_class = 'col-md-8'
self.fields['recipient_approved_public'].label = "I agree to publish this message and display it publicly in the Happiness Archive."
self.fields['recipient_approved_public_named'].label = "... and I agree to display our names publicly too."
self.fields['recipient_approved_public_named'].help_text = "Note: We only publish information if both the sender and the recipients agree."
self.helper.layout = Layout(
Fieldset("Privacy and permissions", 'recipient_approved_public', 'recipient_approved_public_named'),
HTML("<br>"),
Submit('submit', 'Save privacy choices', css_class='btn-lg centered'),
)
示例10: __init__
# 需要导入模块: from crispy_forms import helper [as 别名]
# 或者: from crispy_forms.helper import FormHelper [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.layout = Layout(
Row(
Column('email', css_class='form-group col-md-6 mb-0'),
Column('password', css_class='form-group col-md-6 mb-0'),
css_class='form-row'
),
'address_1',
'address_2',
Row(
Column('city', css_class='form-group col-md-6 mb-0'),
Column('state', css_class='form-group col-md-4 mb-0'),
Column('zip_code', css_class='form-group col-md-2 mb-0'),
css_class='form-row'
),
'check_me_out',
Submit('submit', 'Sign in')
)
示例11: __init__
# 需要导入模块: from crispy_forms import helper [as 别名]
# 或者: from crispy_forms.helper import FormHelper [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'))
示例12: __init__
# 需要导入模块: from crispy_forms import helper [as 别名]
# 或者: from crispy_forms.helper import FormHelper [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')))
示例13: helper
# 需要导入模块: from crispy_forms import helper [as 别名]
# 或者: from crispy_forms.helper import FormHelper [as 别名]
def helper(self):
if not hasattr(self, '_helper'):
self._helper = FormHelper()
self._helper.error_text_inline = self.error_text_inline
self._helper.form_action = self.get_form_action()
self._helper.form_class = self.get_form_class()
self._helper.form_method = self.get_form_method()
for _input in self.get_form_inputs():
self._helper.add_input(_input)
self._helper.layout = self.get_layout(self._helper)
return self._helper
示例14: __init__
# 需要导入模块: from crispy_forms import helper [as 别名]
# 或者: from crispy_forms.helper import FormHelper [as 别名]
def __init__(self, *args, **kwargs):
super(MainForm, self).__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.form_class = 'form-inline'
self.helper.field_template = 'bootstrap3/layout/inline_field.html'
self.helper.form_show_labels = False
self.helper.layout = Layout(
'domain',
CleanSubmitButton('submit', 'Search Data')
)
示例15: queue_page
# 需要导入模块: from crispy_forms import helper [as 别名]
# 或者: from crispy_forms.helper import FormHelper [as 别名]
def queue_page(request, course_id):
user = request.user
course = get_object_or_404(Course, id=course_id)
if not course.user_can_see_queue(user):
raise PermissionDenied
f = IssueFilter(request.GET, {})
f.set_course(course, user)
session_key = '_'.join([QUEUE_SESSION_PREFIX, str(course_id)])
if request.GET:
request.session[session_key] = f.form.data
elif session_key in request.session:
f.form.data = request.session.get(session_key)
f.form.helper = FormHelper(f.form)
f.form.helper.form_method = 'get'
f.form.helper.layout.append(
HTML(
u"""
<div class="form-group row">
<button id="button_clear" class="btn btn-secondary" type="button">{0}</button>
</div>
<div class="form-group row">
<button id="button_filter" class="btn btn-primary" type="button">{1}</button>
</div>
""".format(_(u'ochistit'), _(u'primenit'))
)
)
schools = course.school_set.all()
context = {
'course': course,
'user_is_teacher': course.user_is_teacher(user),
'visible_attendance_log': course.user_can_see_attendance_log(user),
'filter': f,
'school': schools[0] if schools else '',
'full_width_page': True,
'timezone': user.profile.time_zone
}
return render(request, 'courses/queue.html', context)