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 asdatalist
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 theInput.render()
method. See more about exchanging the templates in the documentation about customization.
-
-
class
floppyforms.widgets.
PasswordInput
¶ -
template_name
¶ 'floppyforms/password.html'
-
input_type
¶ password
-
-
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.
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
andclear_checkbox_label
attributes are provided in the template context.-
-
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.
NumberInput
¶ -
template_name
¶ 'floppyforms/number.html'
-
input_type
¶ number
-
min
¶ None
-
max
¶ None
-
step
¶ None
min
,max
andstep
are available in theattrs
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
andstep
are available in theattrs
template variable if they are not None.-
-
class
floppyforms.widgets.
Textarea
¶ -
template_name
¶ 'floppyforms/textarea.html'
-
rows
¶ 10
-
cols
¶ 40
rows
andcols
are available in theattrs
variable.-
-
class
floppyforms.widgets.
CheckboxInput
¶ -
template_name
¶ 'floppyforms/checkbox.html'
-
input_type
¶ checkbox
-
-
class
floppyforms.widgets.
MultiWidget
¶ The same as
django.forms.widgets.MultiWidget
. The rendering can be customized by overridingformat_output
, which joins all the rendered widgets.
-
class
floppyforms.widgets.
SplitDateTimeWidget
¶ Displays a
DateInput
and aTimeInput
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'
.