Html5 Fields

class html5forms.fields.Html5Field(placeholder=None, autofocus=False, *args, **kwargs)

Base class for Html5 Fields

Used only for extending

Parameters:
  • placeholder (String) – placeholder text to display if field in unfocused
  • autofocus (Boolean) – should the field be focused on load
class html5forms.fields.Html5CharField(max_length=None, min_length=None, datalist=None, *args, **kwargs)

Your basic inputfield

Parameters:
  • placeholder (String) – placeholder text to display if field in unfocused
  • autofocus (Boolean) – should the field be focused on load
  • datalist (list of two-tuples) – choices for inbuild HTML5 autocompleter
  • min_length (Integer) – minimum length for field
  • max_length (Integer) – maximum length for field
class html5forms.fields.Html5PasswordField(max_length=None, min_length=None, datalist=None, *args, **kwargs)

Password field

Parameters:
  • placeholder (String) – placeholder text to display if field in unfocused
  • autofocus (Boolean) – should the field be focused on load
  • min_length (Integer) – minimum length for field
  • max_length (Integer) – maximum length for field
class html5forms.fields.Html5SearchField(max_length=None, min_length=None, datalist=None, *args, **kwargs)

Search field

apart from default widget works just like CharField

class html5forms.fields.Html5EmailField(max_length=None, min_length=None, datalist=None, *args, **kwargs)

Email Field

Parameters:
  • placeholder (String) – placeholder text to display if field in unfocused
  • autofocus (Boolean) – should the field be focused on load
  • datalist (list of two-tuples) – choices for inbuild HTML5 autocompleter
  • min_length (Integer) – minimum length for field
  • max_length (Integer) – maximum length for field
class html5forms.fields.Html5URLField(max_length=None, min_length=None, verify_exists=False, validator_user_agent='Django/1.2.3 (http://www.djangoproject.com)', *args, **kwargs)

Url Field

Parameters:
  • placeholder (String) – placeholder text to display if field in unfocused
  • autofocus (Boolean) – should the field be focused on load
  • datalist (list of two-tuples) – choices for inbuild HTML5 autocompleter
  • min_length (Integer) – minimum length for field
  • max_length (Integer) – maximum length for field
  • verify_exists (Boolean) – check whether specified url address exists (is not 404), default False
  • validator_user_agent (String) – String used as the user-agent used when checking for a URL’s existence. Defaults to the value of the URL_VALIDATOR_USER_AGENT setting.
class html5forms.fields.Html5IntegerField(max_value=None, min_value=None, step=None, *args, **kwargs)

Integer Field

Parameters:
  • placeholder (String) – placeholder text to display if field in unfocused
  • autofocus (Boolean) – should the field be focused on load
  • min_value (Integer) – minimum value for field
  • max_value (Integer) – maximum value for field
  • step (Integer) – step for number selector (eg. 2 for 2,4,6,8...)
to_python(value)

Validates that int() can be called on the input. Returns the result of int(). Returns None for empty values.

Previous topic

Welcome to django-html5-forms’s documentation!

Next topic

Html5 Widgets

This Page