我们从Python开源项目中,提取了以下25个代码示例,用于说明如何使用crispy_forms.layout.Fieldset()。
def __init__(self, *args, **kwargs): super(BulletinFilterForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_action = "" self.helper.form_method = "GET" self.helper.layout = layout.Layout( layout.Fieldset( _("Filter bulletins"), layout.Field("bulletin_type"), layout.Field("category"), ), bootstrap.FormActions( layout.Submit("submit", _("Filter")), ), )
def __init__(self, *args, **kwargs): super(CustAuthForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.form_action = reverse('users:auth_login') self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-sm-3' self.helper.field_class = 'col-sm-9' self.helper.error_text_inline = False self.helper.layout = Layout( Hidden('next', value=reverse('home')), Fieldset('', 'username', 'password', HTML(u'<strong><a href="%s" class="btn btn-link col-sm-offset-3 modal-link">%s</a></strong>' % (reverse('password_reset'), _(u'Forgot your password?'))), 'captcha'), ButtonHolder(Submit('submit_button', _(u'Log in')), Button('cancel_button', _(u'Cancel'), css_class='btn-default')))
def __init__(self, *args, **kwargs): super(CustPswResetForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.form_action = reverse('password_reset') self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-md-3' self.helper.field_class = 'col-md-9' self.helper.error_text_inline = False self.helper.add_input(Submit('submit_button', _(u'Confirm'))) self.helper.add_input(Button('cancel_button', _(u'Cancel'), css_class='btn-default')) # self.helper.layout = Layout( # # Hidden('next', value=reverse('home')), # HTML(u"<p>%s</p>" % _(u"Forgot your password? Enter your email in the form below and we'll send you instructions for creating a new one.")), # Fieldset('', 'email', 'captcha'), # ButtonHolder(Submit('submit_button', _(u'Confirm')), # Button('cancel_button', _(u'Cancel'), css_class='btn-default')))
def __init__(self, legend, *fields, **kwargs): self.description = kwargs.pop('description', None) self.collapsed = kwargs.pop('collapsed', None) super(Fieldset, self).__init__(legend, *fields, **kwargs)
def __init__(self, *args, **kwargs): super(InspirationQuoteForm, self).__init__(*args, **kwargs) self.helper = FormHelper() self.helper.form_action = "" self.helper.form_method = "POST" self.helper.layout = layout.Layout( layout.Fieldset( _("Quote"), layout.Field("author"), layout.Field("quote", rows=3), layout.HTML(""" {% include "quotes/includes/image_upload_widget.html" %} """), layout.Field("picture_path"), # hidden layout.Field("delete_picture"), # hidden ), bootstrap.FormActions( layout.Submit("submit", _("Save"), css_class="btn btn-primary"), ) )
def __init__(self, *args, **kwargs): super(CustSetPswForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-md-3' self.helper.field_class = 'col-md-9' self.helper.error_text_inline = False self.helper.layout = Layout( HTML(u"<p>%s</p>" % _(u"Enter your new password below to reset your password:")), Fieldset('', 'new_password1', 'new_password2'), ButtonHolder(Submit('submit_button', _(u'Confirm')), Button('cancel_button', _(u'Cancel'), css_class='btn-default')))