forms.Widget.attrs

attrs A dictionary containing HTML attributes to be set on the rendered widget. >>> from django import forms >>> name = forms.TextInput(attrs={'size': 10, 'title': 'Your name',}) >>> name.render('name', 'A name') '<input title="Your name" type="text" name="name" value="A name" size="10" required />' If you assign a value of True or False to an attribute, it will be rendered as an HTML5 boolean attribute: >>> name = forms.TextInput(attrs={'required':

forms.Widget

class Widget(attrs=None) [source] This abstract class cannot be rendered, but provides the basic attribute attrs. You may also implement or override the render() method on custom widgets. attrs A dictionary containing HTML attributes to be set on the rendered widget. >>> from django import forms >>> name = forms.TextInput(attrs={'size': 10, 'title': 'Your name',}) >>> name.render('name', 'A name') '<input title="Your name" type="text" name="name" value="A nam

forms.UUIDField

class UUIDField(**kwargs) [source] Default widget: TextInput Empty value: '' (an empty string) Normalizes to: A UUID object. Error message keys: required, invalid This field will accept any string format accepted as the hex argument to the UUID constructor.

forms.URLInput

class URLInput [source] Text input: <input type="url" ...>

forms.URLField.min_length

min_length These are the same as CharField.max_length and CharField.min_length.

forms.URLField.max_length

max_length

forms.URLField

class URLField(**kwargs) [source] Default widget: URLInput Empty value: '' (an empty string) Normalizes to: A Unicode object. Validates that the given value is a valid URL. Error message keys: required, invalid Takes the following optional arguments: max_length min_length These are the same as CharField.max_length and CharField.min_length.

forms.TypedMultipleChoiceField

class TypedMultipleChoiceField(**kwargs) [source] Just like a MultipleChoiceField, except TypedMultipleChoiceField takes two extra arguments, coerce and empty_value. Default widget: SelectMultiple Empty value: Whatever you’ve given as empty_value Normalizes to: A list of values of the type provided by the coerce argument. Validates that the given values exists in the list of choices and can be coerced. Error message keys: required, invalid_choice The invalid_choice error message may con

forms.TypedChoiceField.empty_value

empty_value The value to use to represent “empty.” Defaults to the empty string; None is another common choice here. Note that this value will not be coerced by the function given in the coerce argument, so choose it accordingly.

forms.TypedChoiceField.coerce

coerce A function that takes one argument and returns a coerced value. Examples include the built-in int, float, bool and other types. Defaults to an identity function. Note that coercion happens after input validation, so it is possible to coerce to a value not present in choices.