Buttons¶
- References
- class crispy_forms_foundation.layout.buttons.ButtonHolder(*fields, css_id=None, css_class=None, template=None)[source]¶
Bases:
ButtonHolderIt wraps fields in an element
<div class="button-holder">.This is where you should put Layout objects that render to form buttons like Submit. It should only hold
HTMLandBaseInputinherited objects.Example:
ButtonHolder( HTML(<span style="display: hidden;">Information Saved</span>), Submit('Save', 'Save') )
- class crispy_forms_foundation.layout.buttons.ButtonHolderCallout(field, *args, **kwargs)[source]¶
Bases:
ButtonHolderAct like
ButtonHolderbut add acalloutclass name on the maindiv.
- class crispy_forms_foundation.layout.buttons.ButtonGroup(*fields, **kwargs)[source]¶
Bases:
LayoutObjectIt wraps fields in an element
<div class="button-group">.This is where you should put Layout objects that render to form buttons like Submit. It should only hold HTML and BaseInput inherited objects.
Example:
ButtonGroup( Submit('Save', 'Save'), Button('Cancel', 'Cancel'), )
- class crispy_forms_foundation.layout.buttons.Button(name, value, *, css_id=None, css_class=None, template=None, **kwargs)[source]¶
Bases:
InputButtonThis is the old Button object that inherit from
InputButtonfor backward compatibility.If you want to stand for an input button, you are invited to use
InputButtoninstead to avoid problem whenButtonElementwill become the newButtonobject.
- class crispy_forms_foundation.layout.buttons.Submit(name, value, *, css_id=None, css_class=None, template=None, **kwargs)[source]¶
Bases:
InputSubmitThis is the old Button object that inherit from
InputSubmitfor backward compatibility.If you want to stand for an input button, you are invited to use
InputSubmitinstead to avoid problem whenButtonSubmitwill become the newSubmitobject.
- class crispy_forms_foundation.layout.buttons.Reset(name, value, *, css_id=None, css_class=None, template=None, **kwargs)[source]¶
Bases:
InputResetThis is the old Button object that inherit from
InputResetfor backward compatibility.If you want to stand for an input button, you are invited to use
InputResetinstead to avoid problem whenButtonResetwill become the newResetobject.
- class crispy_forms_foundation.layout.buttons.InputButton(name, value, *, css_id=None, css_class=None, template=None, **kwargs)[source]¶
Bases:
BaseInputUsed to create a Submit input descriptor for the {% crispy %} template tag:
button = InputButton('Button 1', 'Press Me!')
Note
The first argument is also slugified and turned into the id for the button.
- class crispy_forms_foundation.layout.buttons.InputSubmit(name, value, *, css_id=None, css_class=None, template=None, **kwargs)[source]¶
Bases:
BaseInputUsed to create a Submit button descriptor for the {% crispy %} template tag:
submit = Submit('Search the Site', 'search this site')
- class crispy_forms_foundation.layout.buttons.InputReset(name, value, *, css_id=None, css_class=None, template=None, **kwargs)[source]¶
Bases:
BaseInputUsed to create a Reset button input descriptor for the
{% crispy %}template tag:reset = Reset('Reset This Form', 'Revert Me!')
- class crispy_forms_foundation.layout.buttons.ButtonElement(field, *args, **kwargs)[source]¶
Bases:
BaseInputContrary to
Button, ButtonElement purpose use a<button>element to create a clickable form button and accept an argument to add free content inside element.Advantage of
<button>is to accept almost any HTML content inside element.button = ButtonElement('name', 'value', content="<span>Press Me!</span>")
Note
First argument is for
nameattribute and also turned into the id for the button;Second argument is for
valueattribute and also for element content if not given;Third argument is an optional named argument
content, if given it will be appended inside element instead ofvalue. Content string is marked as safe so you can put anything you want;
- class crispy_forms_foundation.layout.buttons.ButtonSubmit(field, *args, **kwargs)[source]¶
Bases:
ButtonElementCreate a submit button following the
ButtonElementbehaviors:button = ButtonSubmit('search', 'go-search', content="<span>Search this site!</span>")
- class crispy_forms_foundation.layout.buttons.ButtonReset(field, *args, **kwargs)[source]¶
Bases:
ButtonElementCreate a reset button following the
ButtonElementbehaviors:button = ButtonReset('reset', 'revert' content="<span>Revert Me!</span>")