Widgets reference

For each widgets, the default class attributes.

class floppyforms.widgets.Input
datalist

A list of possible values, which will be rendered as a <datalist> element tied to the input. Note that the list of options passed as datalist elements are only suggestions and are not related to form validation.

template_name

A path to a template that should be used to render this widget. You can change the template name per instance by passing in a keyword argument called template_name. This will override the default that is set by the widget class. You can also change the template used for rendering by an argument to the Input.render() method. See more about exchanging the templates in the documentation about customization.

class floppyforms.widgets.TextInput
template_name

'floppyforms/text.html'

input_type

text

class floppyforms.widgets.PasswordInput
template_name

'floppyforms/password.html'

input_type

password

class floppyforms.widgets.HiddenInput
template_name

'floppyforms/hidden.html'

input_type

hidden

class floppyforms.widgets.SlugInput
template_name

'floppyforms/slug.html'

input_type

text

An text input that renders as <input pattern="[-\w]+" ...> for client-side validation of the slug.

class floppyforms.widgets.IPAddressInput
template_name

'floppyforms/ipaddress.html'

input_type

text

An text input that renders as <input pattern="..." ...> for client-side validation. The pattern checks that the entered value is a valid IPv4 address.

class floppyforms.widgets.FileInput
template_name

'floppyforms/file.html'

input_type

file

class floppyforms.widgets.ClearableFileInput
template_name

'floppyforms/clearable_input.html'

input_type

file

initial_text

_('Currently')

input_text

_('Change')

clear_checkbox_label

_('Clear')

The initial_text, input_text and clear_checkbox_label attributes are provided in the template context.

class floppyforms.widgets.EmailInput
template_name

'floppyforms/email.html'

input_type

email

class floppyforms.widgets.URLInput
template_name

'floppyforms/url.html'

input_type

url

class floppyforms.widgets.SearchInput
template_name

'floppyforms/search.html'

input_type

search

class floppyforms.widgets.ColorInput
template_name

'floppyforms/color.html'

input_type

color

class floppyforms.widgets.PhoneNumberInput
template_name

'floppyforms/phonenumber.html'

input_type

tel

class floppyforms.widgets.DateInput
template_name

'floppyforms/date.html'

input_type

date

A widget that renders as <input type="date" value="...">. Value is rendered in ISO-8601 format (i.e. YYYY-MM-DD) regardless of localization settings.

class floppyforms.widgets.DateTimeInput
template_name

'floppyforms/datetime.html'

input_type

datetime

class floppyforms.widgets.TimeInput
template_name

'floppyforms/time.html'

input_type

time

class floppyforms.widgets.NumberInput
template_name

'floppyforms/number.html'

input_type

number

min

None

max

None

step

None

min, max and step are available in the attrs template variable if they are not None.

class floppyforms.widgets.RangeInput
NumberInput.template_name

'floppyforms/range.html'

input_type

range

min

None

max

None

step

None

min, max and step are available in the attrs template variable if they are not None.

class floppyforms.widgets.Textarea
template_name

'floppyforms/textarea.html'

rows

10

cols

40

rows and cols are available in the attrs variable.

class floppyforms.widgets.CheckboxInput
template_name

'floppyforms/checkbox.html'

input_type

checkbox

class floppyforms.widgets.Select
template_name

'floppyforms/select.html'

class floppyforms.widgets.NullBooleanSelect
template_name

'floppyforms/select.html'

class floppyforms.widgets.RadioSelect
template_name

'floppyforms/radio.html'

class floppyforms.widgets.SelectMultiple
template_name

'floppyforms/select_multiple.html'

class floppyforms.widgets.CheckboxSelectMultiple
template_name

'floppyforms/checkbox_select.html'

class floppyforms.widgets.MultiWidget

The same as django.forms.widgets.MultiWidget. The rendering can be customized by overriding format_output, which joins all the rendered widgets.

class floppyforms.widgets.SplitDateTimeWidget

Displays a DateInput and a TimeInput side by side.

class floppyforms.widgets.MultipleHiddenInput

A multiple <input type=”hidden”> for fields that have several values.

class floppyforms.widgets.SelectDateWidget

A widget that displays three <select> boxes, for the year, the month and the date.

Available context:

  • year_field: the name for the year’s <select> box.
  • month_field: the name for the month’s <select> box.
  • day_field: the name for the day’s <select> box.
template_name

The template used to render the widget. Default: 'floppyforms/select_date.html'.

none_value

A tuple representing the value to display when there is no initial value. Default: (0, '---').

day_field

The way the day field’s name is derived from the widget’s name. Default: '%s_day'.

month_field

The way the month field’s name is derived. Default: '%s_month'.

year_field

The way the year field’s name is derived. Default: '%s_year'.