diff --git a/crispy_forms_foundation/__init__.py b/crispy_forms_foundation/__init__.py index b767951..115e488 100644 --- a/crispy_forms_foundation/__init__.py +++ b/crispy_forms_foundation/__init__.py @@ -1,2 +1,2 @@ -"""Django application to add 'django-crispy-forms' layout objects for 'Foundation for sites'""" +"""Django application to add 'django-crispy-forms' layout objects for 'Foundation for sites'""" # noqa: E501 __version__ = '0.5.4' diff --git a/crispy_forms_foundation/forms.py b/crispy_forms_foundation/forms.py index 7c6a218..f610cf0 100644 --- a/crispy_forms_foundation/forms.py +++ b/crispy_forms_foundation/forms.py @@ -10,29 +10,60 @@ from .layout import Submit, HTML, InlineSwitchField + class FoundationFormMixin(object): """ - Mixin to implement the layout helper that will automatically build a form layout - - Generally, you will prefer to use ``FoundationForm`` or ``FoundationModelForm`` instead. - - If you still want to directly use this mixin you'll just have to execute ``FoundationFormMixin.init_helper()`` in your form init. - """ - - title = None #: If set, defines the form's title - layout = None #: If set, override the default layout for the form - error_title = _("Errors :") #: Defines the error title for non field errors - form_id = None #: Defines the id of the form - classes = "foundation-form" #: Defines the classes used on the form - action = "" #: Defines the action of the form. ``reverse`` will be called on the value. On failure the value will be assigned as is - method = "post" #: Defines the method used for the action - attrs = {} #: Defines the attributes of the form - switches = True #: If True, will replace all fields checkboxes with switches - submit = True #: Adds a submit button on the form. Can be set to a Submit object or a string which will be used as the value of the submit button - title_templatestring = u"

{0}

" #: Template string used to display form title (if any) + Mixin to implement the layout helper that will automatically build a form + layout + + Generally, you will prefer to use ``FoundationForm`` or + ``FoundationModelForm`` instead. + + If you still want to directly use this mixin you'll just have to execute + ``FoundationFormMixin.init_helper()`` in your form init. + + **Attributes** + + title + If set, defines the form's title + layout + If set, override the default layout for the form + error_title + Defines the error title for non field errors + form_id + Defines the id of the form + classes + Defines the classes used on the form + action + Defines the action of the form. ``reverse`` will be called on the + value. On failure the value will be assigned as is + method + Defines the method used for the action + attrs + Defines the attributes of the form + switches + If True, will replace all fields checkboxes with switches + submit + Adds a submit button on the form. Can be set to a Submit object or + a string which will be used as the value of the submit button + title_templatestring + Template string used to display form title (if any) + """ + title = None + layout = None + error_title = _("Errors :") + form_id = None + classes = "foundation-form" + action = "" + method = "post" + attrs = {} + switches = True + submit = True + title_templatestring = u"

{0}

" def init_helper(self): - # Put required HTML attribute on required fields so they are managed by Abide (if enabled) + # Put required HTML attribute on required fields so they are managed by + # Abide (if enabled) if "data_abide" in self.attrs: for field in self.fields.values(): if field.required: @@ -46,19 +77,21 @@ def init_helper(self): # Start from the given layout self.helper = FormHelper() self.helper.layout = deepcopy(self.layout) - - # Try to reverse form_action url, else fallback to use it as a simple string + + # Try to reverse form_action url, else fallback to use it as a simple + # string try: self.helper.form_action = reverse(self.action) except NoReverseMatch: self.helper.form_action = self.action if self.title: - self.helper.layout.insert(0, HTML(self.title_templatestring.format(self.title))) - + html = HTML(self.title_templatestring.format(self.title)) + self.helper.layout.insert(0, html) + if self.form_id is not None: self.helper.form_id = self.form_id - + self.helper.form_class = self.classes self.helper.form_method = self.method self.helper.form_error_title = self.error_title @@ -69,8 +102,11 @@ def init_helper(self): layout_field_names = self.helper.layout.get_field_names() # Transform checkbox fields to switches element for pointer in layout_field_names: - if isinstance(self.fields[pointer[1]].widget, forms.CheckboxInput): - self.replace_layout_object(pointer[0], InlineSwitchField(pointer[1], switch_class="inline")) + if isinstance(self.fields[pointer[1]].widget, + forms.CheckboxInput): + field = InlineSwitchField(pointer[1], + switch_class="inline") + self.replace_layout_object(pointer[0], field) if self.submit: if isinstance(self.submit, Submit): @@ -93,12 +129,14 @@ def replace_layout_object(self, position, instead): else: self.helper.layout.fields[position[0]] = instead + class FoundationForm(FoundationFormMixin, forms.Form): """ - A **Django form** that inherit from ``FoundationFormMixin`` to automatically build a form layout + A **Django form** that inherit from ``FoundationFormMixin`` to + automatically build a form layout Example: - + .. sourcecode:: python from django import forms @@ -110,7 +148,7 @@ class YourForm(FoundationForm): layout = Layout(Fieldset("Section", "my_field", "my_field_2")) switches = False attrs = {'data_abide': ""} - + title = forms.CharField(label='Title', required=True) slug = forms.CharField(label='Slug', required=False) @@ -122,10 +160,11 @@ def __init__(self, *args, **kwargs): class FoundationModelForm(FoundationFormMixin, forms.ModelForm): """ - A **Django Model form** that inherit from ``FoundationFormMixin`` to automatically build a form layout + A **Django Model form** that inherit from ``FoundationFormMixin`` to + automatically build a form layout Example: - + .. sourcecode:: python from crispy_forms_foundation.forms import FoundationModelForm diff --git a/crispy_forms_foundation/layout/__init__.py b/crispy_forms_foundation/layout/__init__.py index 52982fb..bbd09ee 100644 --- a/crispy_forms_foundation/layout/__init__.py +++ b/crispy_forms_foundation/layout/__init__.py @@ -1,9 +1,9 @@ """ Layout items for Foundation components -Inherits from the default **crispy_forms** layout objects to force templates on the -right ``TEMPLATE_PACK`` (defined from ``settings.CRISPY_TEMPLATE_PACK``) and implements -Foundation components. +Inherits from the default **crispy_forms** layout objects to force templates on +the right ``TEMPLATE_PACK`` (defined from ``settings.CRISPY_TEMPLATE_PACK``) +and implements Foundation components. """ from __future__ import absolute_import from django.conf import settings @@ -21,4 +21,15 @@ VerticalTabHolder, AccordionItem, AccordionHolder) + +__all__ = [ + "Div", "Panel", "Layout", "UneditableField", "HTML", "Row", "RowFluid", + "Column", "MultiWidgetField", "Field", "MultiField", "SplitDateTimeField", + "InlineField", "InlineJustifiedField", "SwitchField", "InlineSwitchField", + "ButtonHolder", "ButtonHolderPanel", "ButtonGroup", "Button", "Submit", + "Hidden", "Reset", "Container", "ContainerHolder", "Fieldset", "TabItem", + "TabHolder", "VerticalTabHolder", "AccordionItem", "AccordionHolder", +] + + TEMPLATE_PACK = getattr(settings, 'CRISPY_TEMPLATE_PACK', 'foundation-5') diff --git a/crispy_forms_foundation/layout/base.py b/crispy_forms_foundation/layout/base.py index f16ce15..3bd4738 100644 --- a/crispy_forms_foundation/layout/base.py +++ b/crispy_forms_foundation/layout/base.py @@ -8,20 +8,30 @@ TEMPLATE_PACK = getattr(settings, 'CRISPY_TEMPLATE_PACK', 'foundation-5') -class Layout(crispy_forms_layout.Layout): pass -class UneditableField(crispy_forms_layout.HTML): pass -class HTML(crispy_forms_layout.HTML): pass +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 in a
- You can set ``css_id`` for a DOM id and ``css_class`` for a DOM class. Example: + You can set ``css_id`` for a DOM id and ``css_class`` for a DOM class. + + Example: .. sourcecode:: python - Div('form_field_1', 'form_field_2', css_id='div-example', css_class='divs') + Div('form_field_1', 'form_field_2', css_id='div-example', + css_class='divs') """ template = "{0}/layout/div.html".format(TEMPLATE_PACK) @@ -34,7 +44,8 @@ class Panel(crispy_forms_layout.Div): .. sourcecode:: python - Panel('form_field_1', 'form_field_2', css_id='div-example', css_class='divs') + Panel('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', '')+' panel' diff --git a/crispy_forms_foundation/layout/buttons.py b/crispy_forms_foundation/layout/buttons.py index 5471f38..42a565c 100644 --- a/crispy_forms_foundation/layout/buttons.py +++ b/crispy_forms_foundation/layout/buttons.py @@ -5,7 +5,7 @@ * `Foundation buttons `_ for button components; * `Foundation button groups `_ for button groups components; -""" +""" # noqa: E501 from django.conf import settings from django.template import Context from django.template.loader import render_to_string @@ -13,14 +13,17 @@ from crispy_forms.utils import render_field from crispy_forms import layout as crispy_forms_layout + TEMPLATE_PACK = getattr(settings, 'CRISPY_TEMPLATE_PACK', 'foundation-5') + class ButtonHolder(crispy_forms_layout.ButtonHolder): """ It wraps fields in a ``
`` - This is where you should put Layout objects that render to form buttons like Submit. - It should only hold ``HTML`` and ``BaseInput`` inherited objects. + 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: @@ -47,8 +50,8 @@ class ButtonGroup(crispy_forms_layout.LayoutObject): """ It wraps fields in a ``
    `` - This is where you should put Layout objects that render to form buttons like Submit. - It should only hold `HTML` and `BaseInput` inherited objects. + 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: @@ -71,10 +74,14 @@ def render(self, form, form_style, context, template_pack=TEMPLATE_PACK): field_list = [] for field in self.fields: field_list.append( - render_field(field, form, form_style, context, template_pack=template_pack) + render_field(field, form, form_style, context, + template_pack=template_pack) ) - return render_to_string(self.template, Context({'buttongroup': self, 'field_list': field_list})) + return render_to_string(self.template, Context({ + 'buttongroup': self, + 'field_list': field_list, + })) class Button(crispy_forms_layout.BaseInput): @@ -85,7 +92,8 @@ class Button(crispy_forms_layout.BaseInput): button = Button('Button 1', 'Press Me!') - .. note:: The first argument is also slugified and turned into the id for the button. + .. note:: The first argument is also slugified and turned into the id for + the button. """ input_type = 'button' field_classes = 'button' @@ -93,13 +101,15 @@ class Button(crispy_forms_layout.BaseInput): class Submit(crispy_forms_layout.BaseInput): """ - Used to create a Submit button descriptor for the {% crispy %} template tag: + Used to create a Submit button descriptor for the {% crispy %} template + tag: .. sourcecode:: python submit = Submit('Search the Site', 'search this site') - .. note:: The first argument is also slugified and turned into the id for the submit button. + .. note:: The first argument is also slugified and turned into the id for + the submit button. """ input_type = 'submit' field_classes = 'submit button' @@ -115,13 +125,15 @@ class Hidden(crispy_forms_layout.Hidden): class Reset(crispy_forms_layout.BaseInput): """ - Used to create a Reset button input descriptor for the {% crispy %} template tag: + Used to create a Reset button input descriptor for the ``{% crispy %}`` + template tag: .. sourcecode:: python reset = Reset('Reset This Form', 'Revert Me!') - .. note:: The first argument is also slugified and turned into the id for the reset. + .. note:: The first argument is also slugified and turned into the id for + the reset. """ input_type = 'reset' field_classes = 'reset button' diff --git a/crispy_forms_foundation/layout/containers.py b/crispy_forms_foundation/layout/containers.py index 6551973..9dabe3f 100644 --- a/crispy_forms_foundation/layout/containers.py +++ b/crispy_forms_foundation/layout/containers.py @@ -6,7 +6,7 @@ * `Foundation forms `_ for fieldset component; * `Foundation Accordion `_ for accordion components; * `Foundation Tabs `_ for tabs components; -""" +""" # noqa: E501 from random import randint from django.conf import settings @@ -18,11 +18,16 @@ from crispy_forms import bootstrap as crispy_forms_bootstrap from crispy_forms.compatibility import text_type + TEMPLATE_PACK = getattr(settings, 'CRISPY_TEMPLATE_PACK', 'foundation-5') -class Container(crispy_forms_bootstrap.Container): pass -class ContainerHolder(crispy_forms_bootstrap.ContainerHolder): pass +class Container(crispy_forms_bootstrap.Container): + pass + + +class ContainerHolder(crispy_forms_bootstrap.ContainerHolder): + pass class Fieldset(crispy_forms_layout.Fieldset): @@ -59,10 +64,10 @@ class TabHolder(crispy_forms_bootstrap.TabHolder): TabItem('My tab 1', 'form_field_1', 'form_field_2'), TabItem('My tab 2', 'form_field_3') ) - + ``TabHolder`` direct children should allways be a ``TabItem`` layout item. - - The first ``TabItem`` containing a field error will be marked as + + The first ``TabItem`` containing a field error will be marked as *active* if any, else this will be just the first ``TabItem``. """ template = "{0}/layout/tab-holder.html".format(TEMPLATE_PACK) @@ -86,26 +91,28 @@ def render(self, form, form_style, context, template_pack=TEMPLATE_PACK): 'tabs': self, 'links': links, 'content': content })) + class VerticalTabHolder(TabHolder): """ VerticalTabHolder appends vertical class to TabHolder container """ css_class = 'vertical' + class TabItem(crispy_forms_bootstrap.Tab): """ Tab item object. It wraps fields in a div whose default class is "tabs" and - takes a name as first argument. - - The item name is also slugified to build an id for the tab if you don't define - it using ``css_id`` argument. - + takes a name as first argument. + + The item name is also slugified to build an id for the tab if you don't + define it using ``css_id`` argument. + Example: .. sourcecode:: python TabItem('My tab', 'form_field_1', 'form_field_2', 'form_field_3') - + ``TabItem`` layout item has no real utility out of a ``TabHolder``. """ css_class = 'content' @@ -115,19 +122,25 @@ def has_errors(self, form): """ Find tab fields are listed as invalid """ - return any([fieldname_error for fieldname_error in form.errors.keys() if fieldname_error in self]) + return any([fieldname_error for fieldname_error in form.errors.keys() + if fieldname_error in self]) def render_link(self, form): """ - Render the link for the tab-pane. It must be called after render so css_class is updated - with active if needed. + Render the link for the tab-pane. It must be called after render so + ``css_class`` is updated with ``active`` class name if needed. """ - return render_to_string(self.link_template, Context({'link': self, 'item_has_errors': self.has_errors(form)})) + return render_to_string(self.link_template, + Context({ + 'link': self, + 'item_has_errors': self.has_errors(form) + })) class AccordionHolder(crispy_forms_bootstrap.Accordion): """ - Accordion items holder object to wrap Accordion item objects in a container: + Accordion items holder object to wrap Accordion item objects in a + container: .. sourcecode:: python @@ -135,10 +148,11 @@ class AccordionHolder(crispy_forms_bootstrap.Accordion): AccordionItem("group name", "form_field_1", "form_field_2"), AccordionItem("another group name", "form_field"), ) - - ``AccordionHolder`` direct children should allways be a ``AccordionItem`` layout item. - - The first ``AccordionItem`` containing a field error will be marked as + + ``AccordionHolder`` direct children should allways be a ``AccordionItem`` + layout item. + + The first ``AccordionItem`` containing a field error will be marked as *active* if any, else this will be just the first ``AccordionItem``. """ template = "{0}/layout/accordion-holder.html".format(TEMPLATE_PACK) @@ -149,15 +163,18 @@ def render(self, form, form_style, context, template_pack=TEMPLATE_PACK): # accordion group needs the parent div id to set `data-parent` (I don't # know why). This needs to be a unique id if not self.css_id: - self.css_id = "-".join(["accordion", text_type(randint(1000, 9999))]) - - # Active first 'AccordionItem' containing a field error if any, else + self.css_id = "-".join(["accordion", + text_type(randint(1000, 9999))]) + + # Active first 'AccordionItem' containing a field error if any, else # active first holder item self.open_target_group_for_form(form) for group in self.fields: group.data_parent = self.css_id - group.item_has_errors = any([fieldname_error for fieldname_error in form.errors.keys() if fieldname_error in group]) + group.item_has_errors = any([fieldname_error for fieldname_error in + form.errors.keys() + if fieldname_error in group]) content += render_field( group, form, form_style, context, template_pack=template_pack ) @@ -167,13 +184,14 @@ def render(self, form, form_style, context, template_pack=TEMPLATE_PACK): Context({'accordion': self, 'content': content}) ) + class AccordionItem(crispy_forms_bootstrap.AccordionGroup): """ Accordion item object. It wraps given fields inside an accordion tab. It takes accordion tab name as first argument. - - The item name is also slugified to build an id for the tab if you don't define - it using ``css_id`` argument. + + The item name is also slugified to build an id for the tab if you don't + define it using ``css_id`` argument. Example: diff --git a/crispy_forms_foundation/layout/fields.py b/crispy_forms_foundation/layout/fields.py index f16da0a..f7750ec 100644 --- a/crispy_forms_foundation/layout/fields.py +++ b/crispy_forms_foundation/layout/fields.py @@ -5,28 +5,32 @@ * `Foundation forms `_ for input field components; * `Foundation Switches `_ for switches components; -""" +""" # noqa: E501 from django.conf import settings from crispy_forms.utils import render_field from crispy_forms import layout as crispy_forms_layout + TEMPLATE_PACK = getattr(settings, 'CRISPY_TEMPLATE_PACK', 'foundation-5') -class MultiWidgetField(crispy_forms_layout.MultiWidgetField): pass +class MultiWidgetField(crispy_forms_layout.MultiWidgetField): + pass class Field(crispy_forms_layout.Field): """ - Layout object, contain one field name and you can add attributes to it easily. - For setting class attributes, you need to use `css_class`, as `class` is a Python keyword. + Layout object, contain one field name and you can add attributes to it + easily. For setting class attributes, you need to use ``css_class``, + because ``class`` is a reserved Python keyword. Example: .. sourcecode:: python - Field('field_name', style="color: #333;", css_class="whatever", id="field_name") + Field('field_name', style="color: #333;", css_class="whatever", + id="field_name") """ template = "{0}/field.html".format(TEMPLATE_PACK) @@ -41,12 +45,13 @@ class MultiField(crispy_forms_layout.MultiField): class SplitDateTimeField(Field): """ - Just an inherit from ``crispy_forms.layout.Field`` to have a common Field for - displaying field with the ``django.forms.extra.SplitDateTimeWidget`` widget. + Just an inherit from ``crispy_forms.layout.Field`` to have a common Field + for displaying field with the ``django.forms.extra.SplitDateTimeWidget`` + widget. Simply use a specific template """ - template="{0}/layout/splitdatetime_field.html".format(TEMPLATE_PACK) + template = "{0}/layout/splitdatetime_field.html".format(TEMPLATE_PACK) class InlineField(Field): @@ -63,13 +68,15 @@ class InlineField(Field): .. sourcecode:: python - InlineField('field_name', label_column='large-8', input_column='large-4', label_class='') + InlineField('field_name', label_column='large-8', + input_column='large-4', label_class='') ``label_column``, ``input_column``, ``label_class``, are optional argument. """ template = "{0}/layout/inline_field.html".format(TEMPLATE_PACK) - def __init__(self, field, label_column='large-3', input_column='large-9', label_class='', *args, **kwargs): + def __init__(self, field, label_column='large-3', input_column='large-9', + label_class='', *args, **kwargs): self.field = field self.label_column = label_column+' columns' self.input_column = input_column+' columns' @@ -84,16 +91,20 @@ def render(self, form, form_style, context, template_pack=TEMPLATE_PACK): html = '' for field in self.fields: - html += render_field(field, form, form_style, context, template=self.template, attrs=self.attrs, template_pack=template_pack) + html += render_field(field, form, form_style, context, + template=self.template, attrs=self.attrs, + template_pack=template_pack) return html class InlineJustifiedField(InlineField): """ - Same as InlineField but default is to be right aligned with a vertical padding + Same as InlineField but default is to be right aligned with a vertical + padding """ def __init__(self, field, *args, **kwargs): - kwargs['label_class'] = kwargs.get('label_class', None) or 'right inline' + default = 'right inline' + kwargs['label_class'] = kwargs.get('label_class', None) or default super(InlineJustifiedField, self).__init__(field, *args, **kwargs) @@ -101,14 +112,15 @@ class SwitchField(crispy_forms_layout.Field): """ A specific field to use Foundation form switches - You must only use this with a checkbox field and this is a *raw* usage of this - Foundation element, you should see ``InlineSwitchField`` instead. + You must only use this with a checkbox field and this is a *raw* usage of + this Foundation element, you should see ``InlineSwitchField`` instead. Example: .. sourcecode:: python - SwitchField('field_name', style="color: #333;", css_class="whatever", id="field_name") + SwitchField('field_name', style="color: #333;", css_class="whatever", + id="field_name") """ template = "{0}/switch.html".format(TEMPLATE_PACK) @@ -118,14 +130,18 @@ def __init__(self, field, *args, **kwargs): def render(self, form, form_style, context, template_pack=TEMPLATE_PACK): context['switch_class'] = " ".join(self.switch_class) - return super(SwitchField, self).render(form, form_style, context, template_pack) + return super(SwitchField, self).render(form, form_style, context, + template_pack) class InlineSwitchField(InlineField): """ - Like ``SwitchField`` it use Foundation form switches with checkbox field but within an ``InlineField`` + Like ``SwitchField`` it use Foundation form switches with checkbox field + but within an ``InlineField`` - Contrary to ``SwitchField`` this play nice with the label to be able to display it (as Foundation form switches default behavior is to hide the label text) + Contrary to ``SwitchField`` this play nice with the label to be able to + display it (as Foundation form switches default behavior is to hide the + label text) Example: @@ -137,9 +153,12 @@ class InlineSwitchField(InlineField): .. sourcecode:: python - InlineSwitchField('field_name', label_column='large-8', input_column='large-4', label_class='', switch_class="inline") + InlineSwitchField('field_name', label_column='large-8', + input_column='large-4', label_class='', + switch_class="inline") - ``label_column``, ``input_column``, ``label_class``, ``switch_class`` are optional argument. + ``label_column``, ``input_column``, ``label_class``, ``switch_class`` are + optional argument. """ template = "{0}/inline_switch.html".format(TEMPLATE_PACK) @@ -152,4 +171,5 @@ def __init__(self, field, *args, **kwargs): def render(self, form, form_style, context, template_pack=TEMPLATE_PACK): context['switch_class'] = " ".join(self.switch_class) - return super(InlineSwitchField, self).render(form, form_style, context, template_pack) + return super(InlineSwitchField, self).render(form, form_style, context, + template_pack) diff --git a/crispy_forms_foundation/layout/grid.py b/crispy_forms_foundation/layout/grid.py index 6fc36b7..e9fe024 100644 --- a/crispy_forms_foundation/layout/grid.py +++ b/crispy_forms_foundation/layout/grid.py @@ -4,19 +4,15 @@ Foundation grid layout objects See `Foundation Grid`_ for grid components. -""" +""" # noqa: E501 from django.conf import settings -from django.template import Context -from django.template.loader import render_to_string - -from crispy_forms.utils import render_field -from crispy_forms import layout as crispy_forms_layout -from crispy_forms import bootstrap as crispy_forms_bootstrap from crispy_forms_foundation.layout.base import Div + TEMPLATE_PACK = getattr(settings, 'CRISPY_TEMPLATE_PACK', 'foundation-5') + class Row(Div): """ Wrap fields in a div whose default class is ``row``. Example: @@ -33,6 +29,7 @@ class Row(Div): """ css_class = 'row' + class RowFluid(Row): """ Wrap fields in a div whose default class is "row row-fluid". Example: @@ -41,7 +38,10 @@ class RowFluid(Row): RowFluid('form_field_1', 'form_field_2', 'form_field_3') - It has a same behaviour than *Row* but add a CSS class "row-fluid" that you can use to have top level row that take all the container width. You have to put the CSS for this class to your CSS stylesheets. It will embed its items in a div like that: + It has a same behaviour than *Row* but add a CSS class "row-fluid" that you + can use to have top level row that take all the container width. You have + to put the CSS for this class to your CSS stylesheets. It will embed its + items in a div like that: .. sourcecode:: html @@ -52,7 +52,8 @@ class RowFluid(Row): .. sourcecode:: css /* - * Fluid row takes the full width but keep normal row and columns behaviors + * Fluid row takes the full width but keep normal row and columns + * behaviors */ @mixin row-fluid-mixin { max-width: 100%; diff --git a/crispy_forms_foundation/models.py b/crispy_forms_foundation/models.py index 9b890ec..d7a17d2 100644 --- a/crispy_forms_foundation/models.py +++ b/crispy_forms_foundation/models.py @@ -1 +1 @@ -# Nothing here \ No newline at end of file +# Nothing here diff --git a/crispy_forms_foundation/settings.py b/crispy_forms_foundation/settings.py index 7902eba..e97ae2a 100644 --- a/crispy_forms_foundation/settings.py +++ b/crispy_forms_foundation/settings.py @@ -3,13 +3,20 @@ Settings ======== -Default required settings. You can override them in your project -settings file. +Default required settings. You can override them in your project settings +file. -""" # noqa: E501 +""" # Allowed layout pack -CRISPY_ALLOWED_TEMPLATE_PACKS = ('bootstrap', 'uni_form', 'bootstrap3', 'bootstrap4', 'foundation-5') +CRISPY_ALLOWED_TEMPLATE_PACKS = ( + 'bootstrap', + 'uni_form', + 'bootstrap3', + 'bootstrap4', + 'foundation-5' +) + # Default layout pack CRISPY_TEMPLATE_PACK = 'foundation-5'