1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
"""
References:
* `Foundation 6 Callout <https://get.foundation/sites/docs/callout.html>`_;
""" # noqa: E501
from crispy_forms import layout as crispy_forms_layout
__all__ = [
'Layout', 'UneditableField',
'HTML', 'Div',
'Callout',
]
class Layout(crispy_forms_layout.Layout):
pass
class UneditableField(crispy_forms_layout.HTML):
pass
class HTML(crispy_forms_layout.HTML):
pass
class Div(crispy_forms_layout.Div):
"""
It wraps fields inside a ``<div>`` element.
You can set ``css_id`` for element id and ``css_class`` for a element
class names.
Example:
.. code-block:: python
Div('form_field_1', 'form_field_2', css_id='div-example',
css_class='divs')
"""
template = "%s/layout/div.html"
class Callout(crispy_forms_layout.Div):
"""
Act like ``Div`` but add a ``callout`` class name.
Example:
.. code-block:: python
Callout('form_field_1', 'form_field_2', css_id='div-example',
css_class='divs')
"""
def __init__(self, field, *args, **kwargs):
kwargs['css_class'] = kwargs.get('css_class', '')+' callout'
super(Callout, self).__init__(field, *args, **kwargs)
|