Buttons
- References
- class crispy_forms_foundation.layout.buttons.ButtonHolder(*fields, **kwargs)[source]
Bases:
ButtonHolder
It 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
HTML
andBaseInput
inherited 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:
ButtonHolder
Act like
ButtonHolder
but add acallout
class name on the maindiv
.
- class crispy_forms_foundation.layout.buttons.ButtonGroup(*fields, **kwargs)[source]
Bases:
LayoutObject
It 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, **kwargs)[source]
Bases:
InputButton
This is the old Button object that inherit from
InputButton
for backward compatibility.If you want to stand for an input button, you are invited to use
InputButton
instead to avoid problem whenButtonElement
will become the newButton
object.
- class crispy_forms_foundation.layout.buttons.Submit(name, value, **kwargs)[source]
Bases:
InputSubmit
This is the old Button object that inherit from
InputSubmit
for backward compatibility.If you want to stand for an input button, you are invited to use
InputSubmit
instead to avoid problem whenButtonSubmit
will become the newSubmit
object.
- class crispy_forms_foundation.layout.buttons.Reset(name, value, **kwargs)[source]
Bases:
InputReset
This is the old Button object that inherit from
InputReset
for backward compatibility.If you want to stand for an input button, you are invited to use
InputReset
instead to avoid problem whenButtonReset
will become the newReset
object.
- class crispy_forms_foundation.layout.buttons.InputButton(name, value, **kwargs)[source]
Bases:
BaseInput
Used 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, **kwargs)[source]
Bases:
BaseInput
Used 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, **kwargs)[source]
Bases:
BaseInput
Used 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:
BaseInput
Contrary 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
name
attribute and also turned into the id for the button;Second argument is for
value
attribute 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:
ButtonElement
Create a submit button following the
ButtonElement
behaviors:button = ButtonSubmit('search', 'go-search', content="<span>Search this site!</span>")
- class crispy_forms_foundation.layout.buttons.ButtonReset(field, *args, **kwargs)[source]
Bases:
ButtonElement
Create a reset button following the
ButtonElement
behaviors:button = ButtonReset('reset', 'revert' content="<span>Revert Me!</span>")