basxbread.layout.components.forms package

class basxbread.layout.components.forms.CsrfToken

Bases: INPUT

class basxbread.layout.components.forms.DeleteButton(parentcontainerselector, label='Delete', **kwargs)

Bases: Button

class basxbread.layout.components.forms.Form(form, *children, use_csrf=True, standalone=True, formname=None, **kwargs)

Bases: FORM

append(obj)

Append object to the end of the list.

render(context, stringify=True, fragment=None)

Renders this element and its children. Can be overwritten by subclassing elements.

class basxbread.layout.components.forms.Formset(formset, content, formsetinitial=None, fieldname=None, **formsetfactory_kwargs)

Bases: Iterator

add_button(container_css_selector, label='Add', **kwargs)
static as_datatable(formset, fields: List, title: str | None = None, formsetfield_kwargs: dict | None = None, fieldname=None, can_add=True, **kwargs) BaseElement
static as_fieldset(formset, fields: List, title: str | None = None, formsetfield_kwargs: dict | None = None, fieldname=None, can_add=True, **kwargs) BaseElement
static as_inline_datatable(fieldname: str, fields: List, outerform_name: str = 'form', **kwargs)

when used in view the outerform_name can be “form” as it is set in the context by the view for the top-level form

static as_plain(formset, content, add_label='Add', **kwargs)

Shortcut to render a complete formset with add-button

property management_form
class basxbread.layout.components.forms.InlineDeleteButton(parentcontainerselector, label='Delete', **kwargs)

Bases: Button

Submodules

basxbread.layout.components.forms.fields module

basxbread.layout.components.forms.fields.FormField(fieldname: str | None = None, form: Form | Lazy | str = '__basxbread_form', no_wrapper: bool = False, no_label: bool = False, no_helptext: bool = False, show_hidden_initial: bool = False, widgetclass: Type[BaseWidget] | Lazy | None = None, label: str | BaseElement | None = None, help_text: str | BaseElement | None = None, errors: List[str] | None = None, inputelement_attrs: dict | Lazy | None = None, **attributes) FormFieldMarker

Function to produce a carbon design based form field widget which is compatible with Django forms and based on htmlgenerator.

class basxbread.layout.components.forms.fields.FormFieldMarker(fieldname, field)

Bases: BaseElement

basxbread.layout.components.forms.fields.generate_widget_element(fieldname: str | None = None, form: Form | Lazy | str = '__basxbread_form', no_wrapper: bool = False, no_label: bool = False, no_helptext: bool = False, show_hidden_initial: bool = False, widgetclass: Type[BaseWidget] | Lazy | None = None, label: str | BaseElement | None = None, help_text: str | BaseElement | None = None, errors: List[str] | None = None, inputelement_attrs: dict | Lazy | None = None, **attributes) FormFieldMarker

Function to produce a carbon design based form field widget which is compatible with Django forms and based on htmlgenerator.

basxbread.layout.components.forms.fields.guess_widgetclass(fieldname, form, suggested_widgetclass) Lazy

basxbread.layout.components.forms.helpers module

class basxbread.layout.components.forms.helpers.ErrorList(errors)

Bases: If

class basxbread.layout.components.forms.helpers.HelpText(helptext, disabled=False)

Bases: If

class basxbread.layout.components.forms.helpers.Label(label, _for=None, required=None, disabled=None, **kwargs)

Bases: If

class basxbread.layout.components.forms.helpers.Submit(label=None, name='submit', **attributes)

Bases: DIV

basxbread.layout.components.forms.helpers.to_php_formatstr(formatstr, format_key=None)

Maps a python datetime format string to a PHP format string

This function is usefull because a lot of template/front-end code uses the PHP-format string, e.g. the date-filter of django. The following format specifiers are currently not supported: “%j”, “%U”, “%W”, “%c”, “%x”, “%X” If formatstr is none, the format_key will be used to lookup default django format strings.

basxbread.layout.components.forms.search_select module

class basxbread.layout.components.forms.search_select.SearchSelect(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, backend=None, **attributes)

Bases: BaseWidget

basxbread.layout.components.forms.widgets module

class basxbread.layout.components.forms.widgets.BaseWidget(*args, **kwargs)

Bases: DIV

carbon_input_class: str = ''
carbon_input_error_class: str = ''
django_widget = None
get_input_element(inputelement_attrs, errors, **kwargs)
input_type: str | None = None
with_fieldwrapper()
class basxbread.layout.components.forms.widgets.Checkbox(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, **attributes)

Bases: BaseWidget

carbon_input_class: str = 'bx--checkbox'
django_widget

alias of CheckboxInput

input_type: str | None = 'checkbox'
class basxbread.layout.components.forms.widgets.CheckboxSelectMultiple(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, **attributes)

Bases: BaseWidget

carbon_input_class: str = 'bx--checkbox'
django_widget

alias of CheckboxSelectMultiple

input_type: str | None = 'checkbox'
class basxbread.layout.components.forms.widgets.ClearableFileInput(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, **attributes)

Bases: FileInput

clearable = True
django_widget

alias of ClearableFileInput

class basxbread.layout.components.forms.widgets.DatePicker(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, style_short=False, style_simple=False, format=None, formatkey=None, **attributes)

Bases: BaseWidget

carbon_input_class: str = 'bx--date-picker__input'
django_widget

alias of DateInput

input_type: str | None = 'text'
class basxbread.layout.components.forms.widgets.DateRangeWidget(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, **attributes)

Bases: MultiWidget

django_widget

alias of DateRangeWidget

subwidget(boundfield, djangowidget, djangodata, i)
class basxbread.layout.components.forms.widgets.EmailInput(*args, **attributes)

Bases: TextInput

django_widget

alias of EmailInput

input_type: str | None = 'email'
class basxbread.layout.components.forms.widgets.FileInput(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, **attributes)

Bases: BaseWidget

carbon_input_class: str = 'bx--file-input bx--visually-hidden'
clearable = False
django_widget

alias of FileInput

input_type: str | None = 'file'
class basxbread.layout.components.forms.widgets.HiddenInput(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, **attributes)

Bases: BaseWidget

django_widget

alias of HiddenInput

input_type: str | None = 'hidden'
class basxbread.layout.components.forms.widgets.LazySelect(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, inline=False, choices=None, **attributes)

Bases: Select

django_widget

alias of LazySelect

class basxbread.layout.components.forms.widgets.MultiWidget(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, **attributes)

Bases: BaseWidget

django_widget

alias of MultiWidget

subwidget(boundfield, djangowidget, djangodata, i)
class basxbread.layout.components.forms.widgets.NullBooleanSelect(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, inline=False, choices=None, **attributes)

Bases: Select

django_widget

alias of NullBooleanSelect

class basxbread.layout.components.forms.widgets.NumberInput(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, **attributes)

Bases: BaseWidget

django_widget

alias of NumberInput

input_type: str | None = 'number'
class basxbread.layout.components.forms.widgets.PasswordInput(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, **attributes)

Bases: TextInput

carbon_input_class: str = 'bx--password-input bx--text-input'
carbon_input_error_class: str = 'bx--text-input--invalid'
django_widget

alias of PasswordInput

input_type: str | None = 'password'
class basxbread.layout.components.forms.widgets.PhoneNumberInput(*args, **attributes)

Bases: TextInput

django_widget

alias of PhoneNumberField

input_type: str | None = 'tel'
class basxbread.layout.components.forms.widgets.RadioButton(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, **attributes)

Bases: BaseWidget

carbon_input_class: str = 'bx--radio-button'
django_widget = None
input_type: str | None = 'radio'
class basxbread.layout.components.forms.widgets.RadioSelect(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, **attributes)

Bases: BaseWidget

carbon_input_class: str = 'bx--radio-button'
django_widget

alias of RadioSelect

input_type: str | None = 'radio'
class basxbread.layout.components.forms.widgets.Select(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, inline=False, choices=None, **attributes)

Bases: BaseWidget

carbon_input_class: str = 'bx--select-input'
django_widget

alias of Select

class basxbread.layout.components.forms.widgets.SelectMultiple(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, choices=None, **attributes)

Bases: BaseWidget

django_widget

alias of SelectMultiple

class basxbread.layout.components.forms.widgets.SplitDateTimeWidget(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, **attributes)

Bases: MultiWidget

django_widget

alias of SplitDateTimeWidget

subwidget(boundfield, djangowidget, djangodata, i)
class basxbread.layout.components.forms.widgets.TextInput(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, icon=None, **attributes)

Bases: BaseWidget

carbon_input_class: str = 'bx--text-input'
carbon_input_error_class: str = 'bx--text-input--invalid'
django_widget

alias of TextInput

input_type: str | None = 'text'
class basxbread.layout.components.forms.widgets.Textarea(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, **attributes)

Bases: BaseWidget

carbon_input_class: str = 'bx--text-area bx--text-area--v2'
carbon_input_error_class: str = 'bx--text-area--invalid'
django_widget

alias of Textarea

class basxbread.layout.components.forms.widgets.TimeInput(label=None, help_text=None, errors=None, inputelement_attrs=None, boundfield=None, icon=None, **attributes)

Bases: TextInput

django_widget

alias of TimeInput

input_type: str | None = 'time'
class basxbread.layout.components.forms.widgets.UrlInput(*args, **attributes)

Bases: TextInput

django_widget

alias of URLInput

input_type: str | None = 'url'
basxbread.layout.components.forms.widgets.django2bread_widgetclass(widgetclass, fieldclass=None) Lazy | None