{"title":"Widgets","version":"1.10","locale":"es","docname":"ref/forms/widgets","url":"/es/1.10/ref/forms/widgets/","canonical":"https://djangodocs.dev/es/1.10/ref/forms/widgets/","summary":"A widget is Django’s representation of an HTML input element. The widget handles the rendering of the HTML, and the extraction of data from a GET/POST…","html":"<span id=\"widgets\"></span><h1>Widgets<a class=\"heading-anchor\" href=\"#module-django.forms.widgets\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>A widget is Django’s representation of an HTML input element. The widget\nhandles the rendering of the HTML, and the extraction of data from a GET/POST\ndictionary that corresponds to the widget.</p>\n<aside class=\"admonition admonition-tip\" role=\"note\">\n<p class=\"admonition-title\">Truco</p>\n<p>Widgets should not be confused with the <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/\"><span class=\"doc\">form fields</span></a>.\nForm fields deal with the logic of input validation and are used directly\nin templates. Widgets deal with rendering of HTML form input elements on\nthe web page and extraction of raw submitted data. However, widgets do\nneed to be <a class=\"reference internal\" href=\"#widget-to-field\"><span class=\"std std-ref\">assigned</span></a> to form fields.</p>\n</aside>\n<section id=\"specifying-widgets\">\n<span id=\"widget-to-field\"></span><h2>Specifying widgets<a class=\"heading-anchor\" href=\"#specifying-widgets\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Whenever you specify a field on a form, Django will use a default widget\nthat is appropriate to the type of data that is to be displayed. To find\nwhich widget is used on which field, see the documentation about\n<a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#built-in-fields\"><span class=\"std std-ref\">Built-in Field classes</span></a>.</p>\n<p>However, if you want to use a different widget for a field, you can\njust use the <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.Field.widget\" title=\"django.forms.Field.widget\"><code class=\"xref py py-attr docutils literal notranslate\">widget</code></a> argument on the field definition. For\nexample:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django</span> <span class=\"kn\">import</span> forms\n\n<span class=\"k\">class</span> <span class=\"nc\">CommentForm</span><span class=\"p\">(</span>forms<span class=\"o\">.</span>Form<span class=\"p\">):</span>\n    name <span class=\"o\">=</span> forms<span class=\"o\">.</span>CharField<span class=\"p\">()</span>\n    url <span class=\"o\">=</span> forms<span class=\"o\">.</span>URLField<span class=\"p\">()</span>\n    comment <span class=\"o\">=</span> forms<span class=\"o\">.</span>CharField<span class=\"p\">(</span>widget<span class=\"o\">=</span>forms<span class=\"o\">.</span>Textarea<span class=\"p\">)</span>\n</code></pre></div>\n<p>This would specify a form with a comment that uses a larger <a class=\"reference internal\" href=\"#django.forms.Textarea\" title=\"django.forms.Textarea\"><code class=\"xref py py-class docutils literal notranslate\">Textarea</code></a>\nwidget, rather than the default <a class=\"reference internal\" href=\"#django.forms.TextInput\" title=\"django.forms.TextInput\"><code class=\"xref py py-class docutils literal notranslate\">TextInput</code></a> widget.</p>\n</section>\n<section id=\"setting-arguments-for-widgets\">\n<h2>Setting arguments for widgets<a class=\"heading-anchor\" href=\"#setting-arguments-for-widgets\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Many widgets have optional extra arguments; they can be set when defining the\nwidget on the field. In the following example, the\n<a class=\"reference internal\" href=\"#django.forms.SelectDateWidget.years\" title=\"django.forms.SelectDateWidget.years\"><code class=\"xref py py-attr docutils literal notranslate\">years</code></a> attribute is set for a\n<a class=\"reference internal\" href=\"#django.forms.SelectDateWidget\" title=\"django.forms.SelectDateWidget\"><code class=\"xref py py-class docutils literal notranslate\">SelectDateWidget</code></a>:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django</span> <span class=\"kn\">import</span> forms\n\nBIRTH_YEAR_CHOICES <span class=\"o\">=</span> <span class=\"p\">(</span><span class=\"s1\">&#39;1980&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;1981&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;1982&#39;</span><span class=\"p\">)</span>\nFAVORITE_COLORS_CHOICES <span class=\"o\">=</span> <span class=\"p\">(</span>\n    <span class=\"p\">(</span><span class=\"s1\">&#39;blue&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;Blue&#39;</span><span class=\"p\">),</span>\n    <span class=\"p\">(</span><span class=\"s1\">&#39;green&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;Green&#39;</span><span class=\"p\">),</span>\n    <span class=\"p\">(</span><span class=\"s1\">&#39;black&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;Black&#39;</span><span class=\"p\">),</span>\n<span class=\"p\">)</span>\n\n<span class=\"k\">class</span> <span class=\"nc\">SimpleForm</span><span class=\"p\">(</span>forms<span class=\"o\">.</span>Form<span class=\"p\">):</span>\n    birth_year <span class=\"o\">=</span> forms<span class=\"o\">.</span>DateField<span class=\"p\">(</span>widget<span class=\"o\">=</span>forms<span class=\"o\">.</span>SelectDateWidget<span class=\"p\">(</span>years<span class=\"o\">=</span>BIRTH_YEAR_CHOICES<span class=\"p\">))</span>\n    favorite_colors <span class=\"o\">=</span> forms<span class=\"o\">.</span>MultipleChoiceField<span class=\"p\">(</span>\n        required<span class=\"o\">=</span><span class=\"kc\">False</span><span class=\"p\">,</span>\n        widget<span class=\"o\">=</span>forms<span class=\"o\">.</span>CheckboxSelectMultiple<span class=\"p\">,</span>\n        choices<span class=\"o\">=</span>FAVORITE_COLORS_CHOICES<span class=\"p\">,</span>\n    <span class=\"p\">)</span>\n</code></pre></div>\n<p>See the <a class=\"reference internal\" href=\"#built-in-widgets\"><span class=\"std std-ref\">Built-in widgets</span></a> for more information about which widgets\nare available and which arguments they accept.</p>\n</section>\n<section id=\"widgets-inheriting-from-the-select-widget\">\n<h2>Widgets inheriting from the <code class=\"docutils literal notranslate\">Select</code> widget<a class=\"heading-anchor\" href=\"#widgets-inheriting-from-the-select-widget\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Widgets inheriting from the <a class=\"reference internal\" href=\"#django.forms.Select\" title=\"django.forms.Select\"><code class=\"xref py py-class docutils literal notranslate\">Select</code></a> widget deal with choices. They\npresent the user with a list of options to choose from. The different widgets\npresent this choice differently; the <a class=\"reference internal\" href=\"#django.forms.Select\" title=\"django.forms.Select\"><code class=\"xref py py-class docutils literal notranslate\">Select</code></a> widget itself uses a\n<code class=\"docutils literal notranslate\">&lt;select&gt;</code> HTML list representation, while <a class=\"reference internal\" href=\"#django.forms.RadioSelect\" title=\"django.forms.RadioSelect\"><code class=\"xref py py-class docutils literal notranslate\">RadioSelect</code></a> uses radio\nbuttons.</p>\n<p><a class=\"reference internal\" href=\"#django.forms.Select\" title=\"django.forms.Select\"><code class=\"xref py py-class docutils literal notranslate\">Select</code></a> widgets are used by default on <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.ChoiceField\" title=\"django.forms.ChoiceField\"><code class=\"xref py py-class docutils literal notranslate\">ChoiceField</code></a> fields. The\nchoices displayed on the widget are inherited from the <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.ChoiceField\" title=\"django.forms.ChoiceField\"><code class=\"xref py py-class docutils literal notranslate\">ChoiceField</code></a> and\nchanging <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.ChoiceField.choices\" title=\"django.forms.ChoiceField.choices\"><code class=\"xref py py-attr docutils literal notranslate\">ChoiceField.choices</code></a> will update <a class=\"reference internal\" href=\"#django.forms.Select.choices\" title=\"django.forms.Select.choices\"><code class=\"xref py py-attr docutils literal notranslate\">Select.choices</code></a>. For\nexample:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"kn\">from</span> <span class=\"nn\">django</span> <span class=\"kn\">import</span> forms\n<span class=\"gp\">&gt;&gt;&gt; </span>CHOICES <span class=\"o\">=</span> <span class=\"p\">((</span><span class=\"s1\">&#39;1&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;First&#39;</span><span class=\"p\">,),</span> <span class=\"p\">(</span><span class=\"s1\">&#39;2&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;Second&#39;</span><span class=\"p\">,))</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>choice_field <span class=\"o\">=</span> forms<span class=\"o\">.</span>ChoiceField<span class=\"p\">(</span>widget<span class=\"o\">=</span>forms<span class=\"o\">.</span>RadioSelect<span class=\"p\">,</span> choices<span class=\"o\">=</span>CHOICES<span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>choice_field<span class=\"o\">.</span>choices\n<span class=\"go\">[(&#39;1&#39;, &#39;First&#39;), (&#39;2&#39;, &#39;Second&#39;)]</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>choice_field<span class=\"o\">.</span>widget<span class=\"o\">.</span>choices\n<span class=\"go\">[(&#39;1&#39;, &#39;First&#39;), (&#39;2&#39;, &#39;Second&#39;)]</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>choice_field<span class=\"o\">.</span>widget<span class=\"o\">.</span>choices <span class=\"o\">=</span> <span class=\"p\">()</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>choice_field<span class=\"o\">.</span>choices <span class=\"o\">=</span> <span class=\"p\">((</span><span class=\"s1\">&#39;1&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;First and only&#39;</span><span class=\"p\">,),)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>choice_field<span class=\"o\">.</span>widget<span class=\"o\">.</span>choices\n<span class=\"go\">[(&#39;1&#39;, &#39;First and only&#39;)]</span>\n</code></pre></div>\n<p>Widgets which offer a <a class=\"reference internal\" href=\"#django.forms.Select.choices\" title=\"django.forms.Select.choices\"><code class=\"xref py py-attr docutils literal notranslate\">choices</code></a> attribute can however be used\nwith fields which are not based on choice – such as a <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.CharField\" title=\"django.forms.CharField\"><code class=\"xref py py-class docutils literal notranslate\">CharField</code></a> –\nbut it is recommended to use a <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.ChoiceField\" title=\"django.forms.ChoiceField\"><code class=\"xref py py-class docutils literal notranslate\">ChoiceField</code></a>-based field when the\nchoices are inherent to the model and not just the representational widget.</p>\n</section>\n<section id=\"customizing-widget-instances\">\n<h2>Customizing widget instances<a class=\"heading-anchor\" href=\"#customizing-widget-instances\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>When Django renders a widget as HTML, it only renders very minimal markup -\nDjango doesn’t add class names, or any other widget-specific attributes. This\nmeans, for example, that all <a class=\"reference internal\" href=\"#django.forms.TextInput\" title=\"django.forms.TextInput\"><code class=\"xref py py-class docutils literal notranslate\">TextInput</code></a> widgets will appear the same\non your Web pages.</p>\n<p>There are two ways to customize widgets: <a class=\"reference internal\" href=\"#styling-widget-instances\"><span class=\"std std-ref\">per widget instance</span></a> and <a class=\"reference internal\" href=\"#styling-widget-classes\"><span class=\"std std-ref\">per widget class</span></a>.</p>\n<section id=\"styling-widget-instances\">\n<span id=\"id1\"></span><h3>Styling widget instances<a class=\"heading-anchor\" href=\"#styling-widget-instances\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>If you want to make one widget instance look different from another, you will\nneed to specify additional attributes at the time when the widget object is\ninstantiated and assigned to a form field (and perhaps add some rules to your\nCSS files).</p>\n<p>For example, take the following simple form:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django</span> <span class=\"kn\">import</span> forms\n\n<span class=\"k\">class</span> <span class=\"nc\">CommentForm</span><span class=\"p\">(</span>forms<span class=\"o\">.</span>Form<span class=\"p\">):</span>\n    name <span class=\"o\">=</span> forms<span class=\"o\">.</span>CharField<span class=\"p\">()</span>\n    url <span class=\"o\">=</span> forms<span class=\"o\">.</span>URLField<span class=\"p\">()</span>\n    comment <span class=\"o\">=</span> forms<span class=\"o\">.</span>CharField<span class=\"p\">()</span>\n</code></pre></div>\n<p>This form will include three default <a class=\"reference internal\" href=\"#django.forms.TextInput\" title=\"django.forms.TextInput\"><code class=\"xref py py-class docutils literal notranslate\">TextInput</code></a> widgets, with default\nrendering – no CSS class, no extra attributes. This means that the input boxes\nprovided for each widget will be rendered exactly the same:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>f <span class=\"o\">=</span> CommentForm<span class=\"p\">(</span>auto_id<span class=\"o\">=</span><span class=\"kc\">False</span><span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>f<span class=\"o\">.</span>as_table<span class=\"p\">()</span>\n<span class=\"go\">&lt;tr&gt;&lt;th&gt;Name:&lt;/th&gt;&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;name&quot; required /&gt;&lt;/td&gt;&lt;/tr&gt;</span>\n<span class=\"go\">&lt;tr&gt;&lt;th&gt;Url:&lt;/th&gt;&lt;td&gt;&lt;input type=&quot;url&quot; name=&quot;url&quot; required /&gt;&lt;/td&gt;&lt;/tr&gt;</span>\n<span class=\"go\">&lt;tr&gt;&lt;th&gt;Comment:&lt;/th&gt;&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;comment&quot; required /&gt;&lt;/td&gt;&lt;/tr&gt;</span>\n</code></pre></div>\n<p>On a real Web page, you probably don’t want every widget to look the same. You\nmight want a larger input element for the comment, and you might want the\n“name” widget to have some special CSS class. It is also possible to specify\nthe “type” attribute to take advantage of the new HTML5 input types.  To do\nthis, you use the <a class=\"reference internal\" href=\"#django.forms.Widget.attrs\" title=\"django.forms.Widget.attrs\"><code class=\"xref py py-attr docutils literal notranslate\">Widget.attrs</code></a> argument when creating the widget:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"k\">class</span> <span class=\"nc\">CommentForm</span><span class=\"p\">(</span>forms<span class=\"o\">.</span>Form<span class=\"p\">):</span>\n    name <span class=\"o\">=</span> forms<span class=\"o\">.</span>CharField<span class=\"p\">(</span>widget<span class=\"o\">=</span>forms<span class=\"o\">.</span>TextInput<span class=\"p\">(</span>attrs<span class=\"o\">=</span><span class=\"p\">{</span><span class=\"s1\">&#39;class&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;special&#39;</span><span class=\"p\">}))</span>\n    url <span class=\"o\">=</span> forms<span class=\"o\">.</span>URLField<span class=\"p\">()</span>\n    comment <span class=\"o\">=</span> forms<span class=\"o\">.</span>CharField<span class=\"p\">(</span>widget<span class=\"o\">=</span>forms<span class=\"o\">.</span>TextInput<span class=\"p\">(</span>attrs<span class=\"o\">=</span><span class=\"p\">{</span><span class=\"s1\">&#39;size&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;40&#39;</span><span class=\"p\">}))</span>\n</code></pre></div>\n<p>Django will then include the extra attributes in the rendered output:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>f <span class=\"o\">=</span> CommentForm<span class=\"p\">(</span>auto_id<span class=\"o\">=</span><span class=\"kc\">False</span><span class=\"p\">)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>f<span class=\"o\">.</span>as_table<span class=\"p\">()</span>\n<span class=\"go\">&lt;tr&gt;&lt;th&gt;Name:&lt;/th&gt;&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;name&quot; class=&quot;special&quot; required /&gt;&lt;/td&gt;&lt;/tr&gt;</span>\n<span class=\"go\">&lt;tr&gt;&lt;th&gt;Url:&lt;/th&gt;&lt;td&gt;&lt;input type=&quot;url&quot; name=&quot;url&quot; required /&gt;&lt;/td&gt;&lt;/tr&gt;</span>\n<span class=\"go\">&lt;tr&gt;&lt;th&gt;Comment:&lt;/th&gt;&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;comment&quot; size=&quot;40&quot; required /&gt;&lt;/td&gt;&lt;/tr&gt;</span>\n</code></pre></div>\n<p>You can also set the HTML <code class=\"docutils literal notranslate\">id</code> using <a class=\"reference internal\" href=\"#django.forms.Widget.attrs\" title=\"django.forms.Widget.attrs\"><code class=\"xref py py-attr docutils literal notranslate\">attrs</code></a>. See\n<a class=\"reference internal\" href=\"/es/1.10/ref/forms/api/#django.forms.BoundField.id_for_label\" title=\"django.forms.BoundField.id_for_label\"><code class=\"xref py py-attr docutils literal notranslate\">BoundField.id_for_label</code></a> for an example.</p>\n</section>\n<section id=\"styling-widget-classes\">\n<span id=\"id2\"></span><h3>Styling widget classes<a class=\"heading-anchor\" href=\"#styling-widget-classes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>With widgets, it is possible to add assets (<code class=\"docutils literal notranslate\">css</code> and <code class=\"docutils literal notranslate\">javascript</code>)\nand more deeply customize their appearance and behavior.</p>\n<p>In a nutshell, you will need to subclass the widget and either\n<a class=\"reference internal\" href=\"/es/1.10/topics/forms/media/#assets-as-a-static-definition\"><span class=\"std std-ref\">define a «Media» inner class</span></a> or\n<a class=\"reference internal\" href=\"/es/1.10/topics/forms/media/#dynamic-property\"><span class=\"std std-ref\">create a «media» property</span></a>.</p>\n<p>These methods involve somewhat advanced Python programming and are described in\ndetail in the <a class=\"reference internal\" href=\"/es/1.10/topics/forms/media/\"><span class=\"doc\">Form Assets</span></a> topic guide.</p>\n</section>\n</section>\n<section id=\"base-widget-classes\">\n<span id=\"id3\"></span><h2>Base widget classes<a class=\"heading-anchor\" href=\"#base-widget-classes\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Base widget classes <a class=\"reference internal\" href=\"#django.forms.Widget\" title=\"django.forms.Widget\"><code class=\"xref py py-class docutils literal notranslate\">Widget</code></a> and <a class=\"reference internal\" href=\"#django.forms.MultiWidget\" title=\"django.forms.MultiWidget\"><code class=\"xref py py-class docutils literal notranslate\">MultiWidget</code></a> are subclassed by\nall the <a class=\"reference internal\" href=\"#built-in-widgets\"><span class=\"std std-ref\">built-in widgets</span></a> and may serve as a\nfoundation for custom widgets.</p>\n<section id=\"widget\">\n<h3><code class=\"docutils literal notranslate\">Widget</code><a class=\"heading-anchor\" href=\"#widget\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.Widget\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">Widget</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">attrs<span class=\"o\">=</span><span class=\"default_value\">None</span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.forms.Widget\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>This abstract class cannot be rendered, but provides the basic attribute\n<a class=\"reference internal\" href=\"#django.forms.Widget.attrs\" title=\"django.forms.Widget.attrs\"><code class=\"xref py py-attr docutils literal notranslate\">attrs</code></a>.  You may also implement or override the\n<a class=\"reference internal\" href=\"#django.forms.Widget.render\" title=\"django.forms.Widget.render\"><code class=\"xref py py-meth docutils literal notranslate\">render()</code></a> method on custom widgets.</p>\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.forms.Widget.attrs\">\n<span class=\"sig-name descname\">attrs</span><a class=\"heading-anchor\" href=\"#django.forms.Widget.attrs\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>A dictionary containing HTML attributes to be set on the rendered\nwidget.</p>\n<div class=\"code-block\" data-language=\"pycon\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python console</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python console code\"><code><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"kn\">from</span> <span class=\"nn\">django</span> <span class=\"kn\">import</span> forms\n<span class=\"gp\">&gt;&gt;&gt; </span>name <span class=\"o\">=</span> forms<span class=\"o\">.</span>TextInput<span class=\"p\">(</span>attrs<span class=\"o\">=</span><span class=\"p\">{</span><span class=\"s1\">&#39;size&#39;</span><span class=\"p\">:</span> <span class=\"mi\">10</span><span class=\"p\">,</span> <span class=\"s1\">&#39;title&#39;</span><span class=\"p\">:</span> <span class=\"s1\">&#39;Your name&#39;</span><span class=\"p\">,})</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>name<span class=\"o\">.</span>render<span class=\"p\">(</span><span class=\"s1\">&#39;name&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;A name&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;input title=&quot;Your name&quot; type=&quot;text&quot; name=&quot;name&quot; value=&quot;A name&quot; size=&quot;10&quot; required /&gt;&#39;</span>\n</code></pre></div>\n<p>If you assign a value of <code class=\"docutils literal notranslate\">True</code> or <code class=\"docutils literal notranslate\">False</code> to an attribute,\nit will be rendered as an HTML5 boolean attribute:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"gp\">&gt;&gt;&gt; </span>name <span class=\"o\">=</span> forms<span class=\"o\">.</span>TextInput<span class=\"p\">(</span>attrs<span class=\"o\">=</span><span class=\"p\">{</span><span class=\"s1\">&#39;required&#39;</span><span class=\"p\">:</span> <span class=\"kc\">True</span><span class=\"p\">})</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>name<span class=\"o\">.</span>render<span class=\"p\">(</span><span class=\"s1\">&#39;name&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;A name&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;input name=&quot;name&quot; type=&quot;text&quot; value=&quot;A name&quot; required /&gt;&#39;</span>\n<span class=\"gp\">&gt;&gt;&gt;</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>name <span class=\"o\">=</span> forms<span class=\"o\">.</span>TextInput<span class=\"p\">(</span>attrs<span class=\"o\">=</span><span class=\"p\">{</span><span class=\"s1\">&#39;required&#39;</span><span class=\"p\">:</span> <span class=\"kc\">False</span><span class=\"p\">})</span>\n<span class=\"gp\">&gt;&gt;&gt; </span>name<span class=\"o\">.</span>render<span class=\"p\">(</span><span class=\"s1\">&#39;name&#39;</span><span class=\"p\">,</span> <span class=\"s1\">&#39;A name&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">&#39;&lt;input name=&quot;name&quot; type=&quot;text&quot; value=&quot;A name&quot; /&gt;&#39;</span>\n</code></pre></div>\n</dd></dl>\n\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.forms.Widget.supports_microseconds\">\n<span class=\"sig-name descname\">supports_microseconds</span><a class=\"heading-anchor\" href=\"#django.forms.Widget.supports_microseconds\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>An attribute that defaults to <code class=\"docutils literal notranslate\">True</code>. If set to <code class=\"docutils literal notranslate\">False</code>, the\nmicroseconds part of <a class=\"reference external\" href=\"https://docs.python.org/3/library/datetime.html#datetime.datetime\" title=\"(en Python versión 3.14)\"><code class=\"xref py py-class docutils literal notranslate\">datetime</code></a> and\n<a class=\"reference external\" href=\"https://docs.python.org/3/library/datetime.html#datetime.time\" title=\"(en Python versión 3.14)\"><code class=\"xref py py-class docutils literal notranslate\">time</code></a> values will be set to <code class=\"docutils literal notranslate\">0</code>.</p>\n<aside class=\"version-note version-added\" data-version=\"1.9\" role=\"note\">\n<p class=\"version-note-title\">New in Django 1.9</p><p>In older versions, this attribute was only defined on the date\nand time widgets (as <code class=\"docutils literal notranslate\">False</code>).</p>\n</aside>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.forms.Widget.format_value\">\n<span class=\"sig-name descname\">format_value</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">value</em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.forms.Widget.format_value\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Cleans and returns a value for use in the widget template. <code class=\"docutils literal notranslate\">value</code>\nisn’t guaranteed to be valid input, therefore subclass implementations\nshould program defensively.</p>\n<aside class=\"version-note version-changed\" data-version=\"1.10\" role=\"note\">\n<p class=\"version-note-title\">Changed in Django 1.10</p><p>In older versions, this method is a private API named\n<code class=\"docutils literal notranslate\">_format_value()</code>. The old name will work until Django 2.0.</p>\n</aside>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.forms.Widget.id_for_label\">\n<span class=\"sig-name descname\">id_for_label</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">self</em>, <em class=\"sig-param\">id_</em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.forms.Widget.id_for_label\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Returns the HTML ID attribute of this widget for use by a <code class=\"docutils literal notranslate\">&lt;label&gt;</code>,\ngiven the ID of the field. Returns <code class=\"docutils literal notranslate\">None</code> if an ID isn’t available.</p>\n<p>This hook is necessary because some widgets have multiple HTML\nelements and, thus, multiple IDs. In that case, this method should\nreturn an ID value that corresponds to the first ID in the widget’s\ntags.</p>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.forms.Widget.render\">\n<span class=\"sig-name descname\">render</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">name</em>, <em class=\"sig-param\">value</em>, <em class=\"sig-param\">attrs<span class=\"o\">=</span><span class=\"default_value\">None</span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.forms.Widget.render\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Returns HTML for the widget, as a Unicode string. This method must be\nimplemented by the subclass, otherwise <code class=\"docutils literal notranslate\">NotImplementedError</code> will be\nraised.</p>\n<p>The “value” given is not guaranteed to be valid input, therefore\nsubclass implementations should program defensively.</p>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.forms.Widget.value_from_datadict\">\n<span class=\"sig-name descname\">value_from_datadict</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">data</em>, <em class=\"sig-param\">files</em>, <em class=\"sig-param\">name</em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.forms.Widget.value_from_datadict\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Given a dictionary of data and this widget’s name, returns the value\nof this widget. <code class=\"docutils literal notranslate\">files</code> may contain data coming from\n<a class=\"reference internal\" href=\"/es/1.10/ref/request-response/#django.http.HttpRequest.FILES\" title=\"django.http.HttpRequest.FILES\"><code class=\"xref py py-attr docutils literal notranslate\">request.FILES</code></a>. Returns <code class=\"docutils literal notranslate\">None</code>\nif a value wasn’t provided. Note also that <code class=\"docutils literal notranslate\">value_from_datadict</code> may\nbe called more than once during handling of form data, so if you\ncustomize it and add expensive processing, you should implement some\ncaching mechanism yourself.</p>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.forms.Widget.value_omitted_from_data\">\n<span class=\"sig-name descname\">value_omitted_from_data</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">data</em>, <em class=\"sig-param\">files</em>, <em class=\"sig-param\">name</em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.forms.Widget.value_omitted_from_data\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><aside class=\"version-note version-added\" data-version=\"1.10.2\" role=\"note\">\n<p class=\"version-note-title\">New in Django 1.10.2</p></aside>\n<p>Given <code class=\"docutils literal notranslate\">data</code> and <code class=\"docutils literal notranslate\">files</code> dictionaries and this widget’s name,\nreturns whether or not there’s data or files for the widget.</p>\n<p>The method’s result affects whether or not a field in a model form\n<a class=\"reference internal\" href=\"/es/1.10/topics/forms/modelforms/#topics-modelform-save\"><span class=\"std std-ref\">falls back to its default</span></a>.</p>\n<p>Special cases are <a class=\"reference internal\" href=\"#django.forms.CheckboxInput\" title=\"django.forms.CheckboxInput\"><code class=\"xref py py-class docutils literal notranslate\">CheckboxInput</code></a>,\n<a class=\"reference internal\" href=\"#django.forms.CheckboxSelectMultiple\" title=\"django.forms.CheckboxSelectMultiple\"><code class=\"xref py py-class docutils literal notranslate\">CheckboxSelectMultiple</code></a>, and\n<a class=\"reference internal\" href=\"#django.forms.SelectMultiple\" title=\"django.forms.SelectMultiple\"><code class=\"xref py py-class docutils literal notranslate\">SelectMultiple</code></a>, which always return\n<code class=\"docutils literal notranslate\">False</code> because an unchecked checkbox and unselected\n<code class=\"docutils literal notranslate\">&lt;select multiple&gt;</code> don’t appear in the data of an HTML form\nsubmission, so it’s unknown whether or not the user submitted a value.</p>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.forms.Widget.use_required_attribute\">\n<span class=\"sig-name descname\">use_required_attribute</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">initial</em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.forms.Widget.use_required_attribute\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><aside class=\"version-note version-added\" data-version=\"1.10.1\" role=\"note\">\n<p class=\"version-note-title\">New in Django 1.10.1</p></aside>\n<p>Given a form field’s <code class=\"docutils literal notranslate\">initial</code> value, returns whether or not the\nwidget can be rendered with the <code class=\"docutils literal notranslate\">required</code> HTML attribute. Forms use\nthis method along with <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.Field.required\" title=\"django.forms.Field.required\"><code class=\"xref py py-attr docutils literal notranslate\">Field.required</code></a> and <a class=\"reference internal\" href=\"/es/1.10/ref/forms/api/#django.forms.Form.use_required_attribute\" title=\"django.forms.Form.use_required_attribute\"><code class=\"xref py py-attr docutils literal notranslate\">Form.use_required_attribute</code></a> to determine whether or not\nto display the <code class=\"docutils literal notranslate\">required</code> attribute for each field.</p>\n<p>By default, returns <code class=\"docutils literal notranslate\">False</code> for hidden widgets and <code class=\"docutils literal notranslate\">True</code>\notherwise. Special cases are <a class=\"reference internal\" href=\"#django.forms.ClearableFileInput\" title=\"django.forms.ClearableFileInput\"><code class=\"xref py py-class docutils literal notranslate\">ClearableFileInput</code></a>,\nwhich returns <code class=\"docutils literal notranslate\">False</code> when <code class=\"docutils literal notranslate\">initial</code> is not set, and\n<a class=\"reference internal\" href=\"#django.forms.CheckboxSelectMultiple\" title=\"django.forms.CheckboxSelectMultiple\"><code class=\"xref py py-class docutils literal notranslate\">CheckboxSelectMultiple</code></a>, which always returns\n<code class=\"docutils literal notranslate\">False</code> because browser validation would require all checkboxes to be\nchecked instead of at least one.</p>\n<p>Override this method in custom widgets that aren’t compatible with\nbrowser validation. For example, a WSYSIWG text editor widget backed by\na hidden <code class=\"docutils literal notranslate\">textarea</code> element may want to always return <code class=\"docutils literal notranslate\">False</code> to\navoid browser validation on the hidden field.</p>\n</dd></dl>\n\n</dd></dl>\n\n</section>\n<section id=\"multiwidget\">\n<h3><code class=\"docutils literal notranslate\">MultiWidget</code><a class=\"heading-anchor\" href=\"#multiwidget\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.MultiWidget\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">MultiWidget</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">widgets</em>, <em class=\"sig-param\">attrs<span class=\"o\">=</span><span class=\"default_value\">None</span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.forms.MultiWidget\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>A widget that is composed of multiple widgets.\n<a class=\"reference internal\" href=\"#django.forms.MultiWidget\" title=\"django.forms.MultiWidget\"><code class=\"xref py py-class docutils literal notranslate\">MultiWidget</code></a> works hand in hand with the\n<a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.MultiValueField\" title=\"django.forms.MultiValueField\"><code class=\"xref py py-class docutils literal notranslate\">MultiValueField</code></a>.</p>\n<p><a class=\"reference internal\" href=\"#django.forms.MultiWidget\" title=\"django.forms.MultiWidget\"><code class=\"xref py py-class docutils literal notranslate\">MultiWidget</code></a> has one required argument:</p>\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.forms.MultiWidget.widgets\">\n<span class=\"sig-name descname\">widgets</span><a class=\"heading-anchor\" href=\"#django.forms.MultiWidget.widgets\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>An iterable containing the widgets needed.</p>\n</dd></dl>\n\n<p>And one required method:</p>\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.forms.MultiWidget.decompress\">\n<span class=\"sig-name descname\">decompress</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">value</em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.forms.MultiWidget.decompress\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>This method takes a single «compressed» value from the field and\nreturns a list of «decompressed» values. The input value can be\nassumed valid, but not necessarily non-empty.</p>\n<p>This method <strong>must be implemented</strong> by the subclass, and since the\nvalue may be empty, the implementation must be defensive.</p>\n<p>The rationale behind «decompression» is that it is necessary to «split»\nthe combined value of the form field into the values for each widget.</p>\n<p>An example of this is how <a class=\"reference internal\" href=\"#django.forms.SplitDateTimeWidget\" title=\"django.forms.SplitDateTimeWidget\"><code class=\"xref py py-class docutils literal notranslate\">SplitDateTimeWidget</code></a> turns a\n<a class=\"reference external\" href=\"https://docs.python.org/3/library/datetime.html#datetime.datetime\" title=\"(en Python versión 3.14)\"><code class=\"xref py py-class docutils literal notranslate\">datetime</code></a> value into a list with date and time split\ninto two separate values:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.forms</span> <span class=\"kn\">import</span> MultiWidget\n\n<span class=\"k\">class</span> <span class=\"nc\">SplitDateTimeWidget</span><span class=\"p\">(</span>MultiWidget<span class=\"p\">):</span>\n\n    <span class=\"c1\"># ...</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">decompress</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">,</span> value<span class=\"p\">):</span>\n        <span class=\"k\">if</span> value<span class=\"p\">:</span>\n            <span class=\"k\">return</span> <span class=\"p\">[</span>value<span class=\"o\">.</span>date<span class=\"p\">(),</span> value<span class=\"o\">.</span>time<span class=\"p\">()</span><span class=\"o\">.</span>replace<span class=\"p\">(</span>microsecond<span class=\"o\">=</span><span class=\"mi\">0</span><span class=\"p\">)]</span>\n        <span class=\"k\">return</span> <span class=\"p\">[</span><span class=\"kc\">None</span><span class=\"p\">,</span> <span class=\"kc\">None</span><span class=\"p\">]</span>\n</code></pre></div>\n<aside class=\"admonition admonition-tip\" role=\"note\">\n<p class=\"admonition-title\">Truco</p>\n<p>Note that <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.MultiValueField\" title=\"django.forms.MultiValueField\"><code class=\"xref py py-class docutils literal notranslate\">MultiValueField</code></a> has a\ncomplementary method <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.MultiValueField.compress\" title=\"django.forms.MultiValueField.compress\"><code class=\"xref py py-meth docutils literal notranslate\">compress()</code></a>\nwith the opposite responsibility - to combine cleaned values of\nall member fields into one.</p>\n</aside>\n</dd></dl>\n\n<p>Other methods that may be useful to override include:</p>\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.forms.MultiWidget.render\">\n<span class=\"sig-name descname\">render</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">name</em>, <em class=\"sig-param\">value</em>, <em class=\"sig-param\">attrs<span class=\"o\">=</span><span class=\"default_value\">None</span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.forms.MultiWidget.render\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Argument <code class=\"docutils literal notranslate\">value</code> is handled differently in this method from the\nsubclasses of <a class=\"reference internal\" href=\"#django.forms.Widget\" title=\"django.forms.Widget\"><code class=\"xref py py-class docutils literal notranslate\">Widget</code></a> because it has to figure out how to\nsplit a single value for display in multiple widgets.</p>\n<p>The <code class=\"docutils literal notranslate\">value</code> argument used when rendering can be one of two things:</p>\n<ul class=\"simple\">\n<li><p>A <code class=\"docutils literal notranslate\">list</code>.</p></li>\n<li><p>A single value (e.g., a string) that is the «compressed» representation\nof a <code class=\"docutils literal notranslate\">list</code> of values.</p></li>\n</ul>\n<p>If <code class=\"docutils literal notranslate\">value</code> is a list, the output of <a class=\"reference internal\" href=\"#django.forms.MultiWidget.render\" title=\"django.forms.MultiWidget.render\"><code class=\"xref py py-meth docutils literal notranslate\">render()</code></a> will\nbe a concatenation of rendered child widgets. If <code class=\"docutils literal notranslate\">value</code> is not a\nlist, it will first be processed by the method\n<a class=\"reference internal\" href=\"#django.forms.MultiWidget.decompress\" title=\"django.forms.MultiWidget.decompress\"><code class=\"xref py py-meth docutils literal notranslate\">decompress()</code></a> to create the list and then rendered.</p>\n<p>When <code class=\"docutils literal notranslate\">render()</code> executes its HTML rendering, each value in the list\nis rendered with the corresponding widget – the first value is\nrendered in the first widget, the second value is rendered in the\nsecond widget, etc.</p>\n<p>Unlike in the single value widgets, method <a class=\"reference internal\" href=\"#django.forms.MultiWidget.render\" title=\"django.forms.MultiWidget.render\"><code class=\"xref py py-meth docutils literal notranslate\">render()</code></a>\nneed not be implemented in the subclasses.</p>\n</dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.forms.MultiWidget.format_output\">\n<span class=\"sig-name descname\">format_output</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">rendered_widgets</em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.forms.MultiWidget.format_output\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Given a list of rendered widgets (as strings), returns a Unicode string\nrepresenting the HTML for the whole lot.</p>\n<p>This hook allows you to format the HTML design of the widgets any way\nyou’d like.</p>\n</dd></dl>\n\n<p>Here’s an example widget which subclasses <a class=\"reference internal\" href=\"#django.forms.MultiWidget\" title=\"django.forms.MultiWidget\"><code class=\"xref py py-class docutils literal notranslate\">MultiWidget</code></a> to display\na date with the day, month, and year in different select boxes. This widget\nis intended to be used with a <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.DateField\" title=\"django.forms.DateField\"><code class=\"xref py py-class docutils literal notranslate\">DateField</code></a> rather than\na <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.MultiValueField\" title=\"django.forms.MultiValueField\"><code class=\"xref py py-class docutils literal notranslate\">MultiValueField</code></a>, thus we have implemented\n<a class=\"reference internal\" href=\"#django.forms.Widget.value_from_datadict\" title=\"django.forms.Widget.value_from_datadict\"><code class=\"xref py py-meth docutils literal notranslate\">value_from_datadict()</code></a>:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">datetime</span> <span class=\"kn\">import</span> date\n<span class=\"kn\">from</span> <span class=\"nn\">django.forms</span> <span class=\"kn\">import</span> widgets\n\n<span class=\"k\">class</span> <span class=\"nc\">DateSelectorWidget</span><span class=\"p\">(</span>widgets<span class=\"o\">.</span>MultiWidget<span class=\"p\">):</span>\n    <span class=\"k\">def</span> <span class=\"fm\">__init__</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">,</span> attrs<span class=\"o\">=</span><span class=\"kc\">None</span><span class=\"p\">):</span>\n        <span class=\"c1\"># create choices for days, months, years</span>\n        <span class=\"c1\"># example below, the rest snipped for brevity.</span>\n        years <span class=\"o\">=</span> <span class=\"p\">[(</span>year<span class=\"p\">,</span> year<span class=\"p\">)</span> <span class=\"k\">for</span> year <span class=\"ow\">in</span> <span class=\"p\">(</span><span class=\"mi\">2011</span><span class=\"p\">,</span> <span class=\"mi\">2012</span><span class=\"p\">,</span> <span class=\"mi\">2013</span><span class=\"p\">)]</span>\n        _widgets <span class=\"o\">=</span> <span class=\"p\">(</span>\n            widgets<span class=\"o\">.</span>Select<span class=\"p\">(</span>attrs<span class=\"o\">=</span>attrs<span class=\"p\">,</span> choices<span class=\"o\">=</span>days<span class=\"p\">),</span>\n            widgets<span class=\"o\">.</span>Select<span class=\"p\">(</span>attrs<span class=\"o\">=</span>attrs<span class=\"p\">,</span> choices<span class=\"o\">=</span>months<span class=\"p\">),</span>\n            widgets<span class=\"o\">.</span>Select<span class=\"p\">(</span>attrs<span class=\"o\">=</span>attrs<span class=\"p\">,</span> choices<span class=\"o\">=</span>years<span class=\"p\">),</span>\n        <span class=\"p\">)</span>\n        <span class=\"nb\">super</span><span class=\"p\">(</span>DateSelectorWidget<span class=\"p\">,</span> <span class=\"bp\">self</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"fm\">__init__</span><span class=\"p\">(</span>_widgets<span class=\"p\">,</span> attrs<span class=\"p\">)</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">decompress</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">,</span> value<span class=\"p\">):</span>\n        <span class=\"k\">if</span> value<span class=\"p\">:</span>\n            <span class=\"k\">return</span> <span class=\"p\">[</span>value<span class=\"o\">.</span>day<span class=\"p\">,</span> value<span class=\"o\">.</span>month<span class=\"p\">,</span> value<span class=\"o\">.</span>year<span class=\"p\">]</span>\n        <span class=\"k\">return</span> <span class=\"p\">[</span><span class=\"kc\">None</span><span class=\"p\">,</span> <span class=\"kc\">None</span><span class=\"p\">,</span> <span class=\"kc\">None</span><span class=\"p\">]</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">format_output</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">,</span> rendered_widgets<span class=\"p\">):</span>\n        <span class=\"k\">return</span> <span class=\"s1\">&#39;&#39;</span><span class=\"o\">.</span>join<span class=\"p\">(</span>rendered_widgets<span class=\"p\">)</span>\n\n    <span class=\"k\">def</span> <span class=\"nf\">value_from_datadict</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">,</span> data<span class=\"p\">,</span> files<span class=\"p\">,</span> name<span class=\"p\">):</span>\n        datelist <span class=\"o\">=</span> <span class=\"p\">[</span>\n            widget<span class=\"o\">.</span>value_from_datadict<span class=\"p\">(</span>data<span class=\"p\">,</span> files<span class=\"p\">,</span> name <span class=\"o\">+</span> <span class=\"s1\">&#39;_</span><span class=\"si\">%s</span><span class=\"s1\">&#39;</span> <span class=\"o\">%</span> i<span class=\"p\">)</span>\n            <span class=\"k\">for</span> i<span class=\"p\">,</span> widget <span class=\"ow\">in</span> <span class=\"nb\">enumerate</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"o\">.</span>widgets<span class=\"p\">)]</span>\n        <span class=\"k\">try</span><span class=\"p\">:</span>\n            D <span class=\"o\">=</span> date<span class=\"p\">(</span>\n                day<span class=\"o\">=</span><span class=\"nb\">int</span><span class=\"p\">(</span>datelist<span class=\"p\">[</span><span class=\"mi\">0</span><span class=\"p\">]),</span>\n                month<span class=\"o\">=</span><span class=\"nb\">int</span><span class=\"p\">(</span>datelist<span class=\"p\">[</span><span class=\"mi\">1</span><span class=\"p\">]),</span>\n                year<span class=\"o\">=</span><span class=\"nb\">int</span><span class=\"p\">(</span>datelist<span class=\"p\">[</span><span class=\"mi\">2</span><span class=\"p\">]),</span>\n            <span class=\"p\">)</span>\n        <span class=\"k\">except</span> <span class=\"ne\">ValueError</span><span class=\"p\">:</span>\n            <span class=\"k\">return</span> <span class=\"s1\">&#39;&#39;</span>\n        <span class=\"k\">else</span><span class=\"p\">:</span>\n            <span class=\"k\">return</span> <span class=\"nb\">str</span><span class=\"p\">(</span>D<span class=\"p\">)</span>\n</code></pre></div>\n<p>The constructor creates several <a class=\"reference internal\" href=\"#django.forms.Select\" title=\"django.forms.Select\"><code class=\"xref py py-class docutils literal notranslate\">Select</code></a> widgets in a tuple. The\n<code class=\"docutils literal notranslate\">super</code> class uses this tuple to setup the widget.</p>\n<p>The <a class=\"reference internal\" href=\"#django.forms.MultiWidget.format_output\" title=\"django.forms.MultiWidget.format_output\"><code class=\"xref py py-meth docutils literal notranslate\">format_output()</code></a> method is fairly vanilla here (in\nfact, it’s the same as what’s been implemented as the default for\n<code class=\"docutils literal notranslate\">MultiWidget</code>), but the idea is that you could add custom HTML between\nthe widgets should you wish.</p>\n<p>The required method <a class=\"reference internal\" href=\"#django.forms.MultiWidget.decompress\" title=\"django.forms.MultiWidget.decompress\"><code class=\"xref py py-meth docutils literal notranslate\">decompress()</code></a> breaks up a\n<code class=\"docutils literal notranslate\">datetime.date</code> value into the day, month, and year values corresponding\nto each widget. Note how the method handles the case where <code class=\"docutils literal notranslate\">value</code> is\n<code class=\"docutils literal notranslate\">None</code>.</p>\n<p>The default implementation of <a class=\"reference internal\" href=\"#django.forms.Widget.value_from_datadict\" title=\"django.forms.Widget.value_from_datadict\"><code class=\"xref py py-meth docutils literal notranslate\">value_from_datadict()</code></a> returns\na list of values corresponding to each <code class=\"docutils literal notranslate\">Widget</code>.  This is appropriate\nwhen using a <code class=\"docutils literal notranslate\">MultiWidget</code> with a <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.MultiValueField\" title=\"django.forms.MultiValueField\"><code class=\"xref py py-class docutils literal notranslate\">MultiValueField</code></a>,\nbut since we want to use this widget with a <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.DateField\" title=\"django.forms.DateField\"><code class=\"xref py py-class docutils literal notranslate\">DateField</code></a>\nwhich takes a single value, we have overridden this method to combine the\ndata of all the subwidgets into a <code class=\"docutils literal notranslate\">datetime.date</code>. The method extracts\ndata from the <code class=\"docutils literal notranslate\">POST</code> dictionary and constructs and validates the date.\nIf it is valid, we return the string, otherwise, we return an empty string\nwhich will cause <code class=\"docutils literal notranslate\">form.is_valid</code> to return <code class=\"docutils literal notranslate\">False</code>.</p>\n</dd></dl>\n\n</section>\n</section>\n<section id=\"built-in-widgets\">\n<span id=\"id4\"></span><h2>Built-in widgets<a class=\"heading-anchor\" href=\"#built-in-widgets\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Django provides a representation of all the basic HTML widgets, plus some\ncommonly used groups of widgets in the <code class=\"docutils literal notranslate\">django.forms.widgets</code> module,\nincluding <a class=\"reference internal\" href=\"#text-widgets\"><span class=\"std std-ref\">the input of text</span></a>, <a class=\"reference internal\" href=\"#selector-widgets\"><span class=\"std std-ref\">various checkboxes\nand selectors</span></a>, <a class=\"reference internal\" href=\"#file-upload-widgets\"><span class=\"std std-ref\">uploading files</span></a>,\nand <a class=\"reference internal\" href=\"#composite-widgets\"><span class=\"std std-ref\">handling of multi-valued input</span></a>.</p>\n<section id=\"widgets-handling-input-of-text\">\n<span id=\"text-widgets\"></span><h3>Widgets handling input of text<a class=\"heading-anchor\" href=\"#widgets-handling-input-of-text\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>These widgets make use of the HTML elements <code class=\"docutils literal notranslate\">input</code> and <code class=\"docutils literal notranslate\">textarea</code>.</p>\n<section id=\"textinput\">\n<h4><code class=\"docutils literal notranslate\">TextInput</code><a class=\"heading-anchor\" href=\"#textinput\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.TextInput\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">TextInput</span><a class=\"heading-anchor\" href=\"#django.forms.TextInput\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Text input: <code class=\"docutils literal notranslate\">&lt;input type=&quot;text&quot; ...&gt;</code></p>\n</dd></dl>\n\n</section>\n<section id=\"numberinput\">\n<h4><code class=\"docutils literal notranslate\">NumberInput</code><a class=\"heading-anchor\" href=\"#numberinput\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.NumberInput\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">NumberInput</span><a class=\"heading-anchor\" href=\"#django.forms.NumberInput\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Text input: <code class=\"docutils literal notranslate\">&lt;input type=&quot;number&quot; ...&gt;</code></p>\n<p>Beware that not all browsers support entering localized numbers in\n<code class=\"docutils literal notranslate\">number</code> input types. Django itself avoids using them for fields having\ntheir <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.Field.localize\" title=\"django.forms.Field.localize\"><code class=\"xref py py-attr docutils literal notranslate\">localize</code></a> property set to <code class=\"docutils literal notranslate\">True</code>.</p>\n</dd></dl>\n\n</section>\n<section id=\"emailinput\">\n<h4><code class=\"docutils literal notranslate\">EmailInput</code><a class=\"heading-anchor\" href=\"#emailinput\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.EmailInput\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">EmailInput</span><a class=\"heading-anchor\" href=\"#django.forms.EmailInput\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Text input: <code class=\"docutils literal notranslate\">&lt;input type=&quot;email&quot; ...&gt;</code></p>\n</dd></dl>\n\n</section>\n<section id=\"urlinput\">\n<h4><code class=\"docutils literal notranslate\">URLInput</code><a class=\"heading-anchor\" href=\"#urlinput\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.URLInput\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">URLInput</span><a class=\"heading-anchor\" href=\"#django.forms.URLInput\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Text input: <code class=\"docutils literal notranslate\">&lt;input type=&quot;url&quot; ...&gt;</code></p>\n</dd></dl>\n\n</section>\n<section id=\"passwordinput\">\n<h4><code class=\"docutils literal notranslate\">PasswordInput</code><a class=\"heading-anchor\" href=\"#passwordinput\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.PasswordInput\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">PasswordInput</span><a class=\"heading-anchor\" href=\"#django.forms.PasswordInput\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Password input: <code class=\"docutils literal notranslate\">&lt;input type='password' ...&gt;</code></p>\n<p>Takes one optional argument:</p>\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.forms.PasswordInput.render_value\">\n<span class=\"sig-name descname\">render_value</span><a class=\"heading-anchor\" href=\"#django.forms.PasswordInput.render_value\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Determines whether the widget will have a value filled in when the\nform is re-displayed after a validation error (default is <code class=\"docutils literal notranslate\">False</code>).</p>\n</dd></dl>\n\n</dd></dl>\n\n</section>\n<section id=\"hiddeninput\">\n<h4><code class=\"docutils literal notranslate\">HiddenInput</code><a class=\"heading-anchor\" href=\"#hiddeninput\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.HiddenInput\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">HiddenInput</span><a class=\"heading-anchor\" href=\"#django.forms.HiddenInput\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Hidden input: <code class=\"docutils literal notranslate\">&lt;input type='hidden' ...&gt;</code></p>\n<p>Note that there also is a <a class=\"reference internal\" href=\"#django.forms.MultipleHiddenInput\" title=\"django.forms.MultipleHiddenInput\"><code class=\"xref py py-class docutils literal notranslate\">MultipleHiddenInput</code></a> widget that\nencapsulates a set of hidden input elements.</p>\n</dd></dl>\n\n</section>\n<section id=\"dateinput\">\n<h4><code class=\"docutils literal notranslate\">DateInput</code><a class=\"heading-anchor\" href=\"#dateinput\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.DateInput\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">DateInput</span><a class=\"heading-anchor\" href=\"#django.forms.DateInput\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Date input as a simple text box: <code class=\"docutils literal notranslate\">&lt;input type='text' ...&gt;</code></p>\n<p>Takes same arguments as <a class=\"reference internal\" href=\"#django.forms.TextInput\" title=\"django.forms.TextInput\"><code class=\"xref py py-class docutils literal notranslate\">TextInput</code></a>, with one more optional argument:</p>\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.forms.DateInput.format\">\n<span class=\"sig-name descname\">format</span><a class=\"heading-anchor\" href=\"#django.forms.DateInput.format\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>The format in which this field’s initial value will be displayed.</p>\n</dd></dl>\n\n<p>If no <code class=\"docutils literal notranslate\">format</code> argument is provided, the default format is the first\nformat found in <a class=\"reference internal\" href=\"/es/1.10/ref/settings/#std-setting-DATE_INPUT_FORMATS\"><code class=\"xref std std-setting docutils literal notranslate\">DATE_INPUT_FORMATS</code></a> and respects\n<a class=\"reference internal\" href=\"/es/1.10/topics/i18n/formatting/\"><span class=\"doc\">Format localization</span></a>.</p>\n</dd></dl>\n\n</section>\n<section id=\"datetimeinput\">\n<h4><code class=\"docutils literal notranslate\">DateTimeInput</code><a class=\"heading-anchor\" href=\"#datetimeinput\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.DateTimeInput\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">DateTimeInput</span><a class=\"heading-anchor\" href=\"#django.forms.DateTimeInput\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Date/time input as a simple text box: <code class=\"docutils literal notranslate\">&lt;input type='text' ...&gt;</code></p>\n<p>Takes same arguments as <a class=\"reference internal\" href=\"#django.forms.TextInput\" title=\"django.forms.TextInput\"><code class=\"xref py py-class docutils literal notranslate\">TextInput</code></a>, with one more optional argument:</p>\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.forms.DateTimeInput.format\">\n<span class=\"sig-name descname\">format</span><a class=\"heading-anchor\" href=\"#django.forms.DateTimeInput.format\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>The format in which this field’s initial value will be displayed.</p>\n</dd></dl>\n\n<p>If no <code class=\"docutils literal notranslate\">format</code> argument is provided, the default format is the first\nformat found in <a class=\"reference internal\" href=\"/es/1.10/ref/settings/#std-setting-DATETIME_INPUT_FORMATS\"><code class=\"xref std std-setting docutils literal notranslate\">DATETIME_INPUT_FORMATS</code></a> and respects\n<a class=\"reference internal\" href=\"/es/1.10/topics/i18n/formatting/\"><span class=\"doc\">Format localization</span></a>.</p>\n<p>By default, the microseconds part of the time value is always set to <code class=\"docutils literal notranslate\">0</code>.\nIf microseconds are required, use a subclass with the\n<a class=\"reference internal\" href=\"#django.forms.Widget.supports_microseconds\" title=\"django.forms.Widget.supports_microseconds\"><code class=\"xref py py-attr docutils literal notranslate\">supports_microseconds</code></a> attribute set to <code class=\"docutils literal notranslate\">True</code>.</p>\n</dd></dl>\n\n</section>\n<section id=\"timeinput\">\n<h4><code class=\"docutils literal notranslate\">TimeInput</code><a class=\"heading-anchor\" href=\"#timeinput\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.TimeInput\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">TimeInput</span><a class=\"heading-anchor\" href=\"#django.forms.TimeInput\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Time input as a simple text box: <code class=\"docutils literal notranslate\">&lt;input type='text' ...&gt;</code></p>\n<p>Takes same arguments as <a class=\"reference internal\" href=\"#django.forms.TextInput\" title=\"django.forms.TextInput\"><code class=\"xref py py-class docutils literal notranslate\">TextInput</code></a>, with one more optional argument:</p>\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.forms.TimeInput.format\">\n<span class=\"sig-name descname\">format</span><a class=\"heading-anchor\" href=\"#django.forms.TimeInput.format\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>The format in which this field’s initial value will be displayed.</p>\n</dd></dl>\n\n<p>If no <code class=\"docutils literal notranslate\">format</code> argument is provided, the default format is the first\nformat found in <a class=\"reference internal\" href=\"/es/1.10/ref/settings/#std-setting-TIME_INPUT_FORMATS\"><code class=\"xref std std-setting docutils literal notranslate\">TIME_INPUT_FORMATS</code></a> and respects\n<a class=\"reference internal\" href=\"/es/1.10/topics/i18n/formatting/\"><span class=\"doc\">Format localization</span></a>.</p>\n<p>For the treatment of microseconds, see <a class=\"reference internal\" href=\"#django.forms.DateTimeInput\" title=\"django.forms.DateTimeInput\"><code class=\"xref py py-class docutils literal notranslate\">DateTimeInput</code></a>.</p>\n</dd></dl>\n\n</section>\n<section id=\"textarea\">\n<h4><code class=\"docutils literal notranslate\">Textarea</code><a class=\"heading-anchor\" href=\"#textarea\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.Textarea\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">Textarea</span><a class=\"heading-anchor\" href=\"#django.forms.Textarea\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Text area: <code class=\"docutils literal notranslate\">&lt;textarea&gt;...&lt;/textarea&gt;</code></p>\n</dd></dl>\n\n</section>\n</section>\n<section id=\"selector-and-checkbox-widgets\">\n<span id=\"selector-widgets\"></span><h3>Selector and checkbox widgets<a class=\"heading-anchor\" href=\"#selector-and-checkbox-widgets\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"checkboxinput\">\n<h4><code class=\"docutils literal notranslate\">CheckboxInput</code><a class=\"heading-anchor\" href=\"#checkboxinput\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.CheckboxInput\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">CheckboxInput</span><a class=\"heading-anchor\" href=\"#django.forms.CheckboxInput\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Checkbox: <code class=\"docutils literal notranslate\">&lt;input type='checkbox' ...&gt;</code></p>\n<p>Takes one optional argument:</p>\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.forms.CheckboxInput.check_test\">\n<span class=\"sig-name descname\">check_test</span><a class=\"heading-anchor\" href=\"#django.forms.CheckboxInput.check_test\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>A callable that takes the value of the <code class=\"docutils literal notranslate\">CheckboxInput</code> and returns\n<code class=\"docutils literal notranslate\">True</code> if the checkbox should be checked for that value.</p>\n</dd></dl>\n\n</dd></dl>\n\n</section>\n<section id=\"select\">\n<h4><code class=\"docutils literal notranslate\">Select</code><a class=\"heading-anchor\" href=\"#select\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.Select\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">Select</span><a class=\"heading-anchor\" href=\"#django.forms.Select\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Select widget: <code class=\"docutils literal notranslate\">&lt;select&gt;&lt;option ...&gt;...&lt;/select&gt;</code></p>\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.forms.Select.choices\">\n<span class=\"sig-name descname\">choices</span><a class=\"heading-anchor\" href=\"#django.forms.Select.choices\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>This attribute is optional when the form field does not have a\n<code class=\"docutils literal notranslate\">choices</code> attribute. If it does, it will override anything you set\nhere when the attribute is updated on the <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.Field\" title=\"django.forms.Field\"><code class=\"xref py py-class docutils literal notranslate\">Field</code></a>.</p>\n</dd></dl>\n\n</dd></dl>\n\n</section>\n<section id=\"nullbooleanselect\">\n<h4><code class=\"docutils literal notranslate\">NullBooleanSelect</code><a class=\"heading-anchor\" href=\"#nullbooleanselect\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.NullBooleanSelect\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">NullBooleanSelect</span><a class=\"heading-anchor\" href=\"#django.forms.NullBooleanSelect\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Select widget with options “Unknown”, “Yes” and “No”</p>\n</dd></dl>\n\n</section>\n<section id=\"selectmultiple\">\n<h4><code class=\"docutils literal notranslate\">SelectMultiple</code><a class=\"heading-anchor\" href=\"#selectmultiple\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.SelectMultiple\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">SelectMultiple</span><a class=\"heading-anchor\" href=\"#django.forms.SelectMultiple\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Similar to <a class=\"reference internal\" href=\"#django.forms.Select\" title=\"django.forms.Select\"><code class=\"xref py py-class docutils literal notranslate\">Select</code></a>, but allows multiple selection:\n<code class=\"docutils literal notranslate\">&lt;select multiple='multiple'&gt;...&lt;/select&gt;</code></p>\n</dd></dl>\n\n</section>\n<section id=\"radioselect\">\n<h4><code class=\"docutils literal notranslate\">RadioSelect</code><a class=\"heading-anchor\" href=\"#radioselect\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.RadioSelect\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">RadioSelect</span><a class=\"heading-anchor\" href=\"#django.forms.RadioSelect\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Similar to <a class=\"reference internal\" href=\"#django.forms.Select\" title=\"django.forms.Select\"><code class=\"xref py py-class docutils literal notranslate\">Select</code></a>, but rendered as a list of radio buttons within\n<code class=\"docutils literal notranslate\">&lt;li&gt;</code> tags:</p>\n<div class=\"code-block\" data-language=\"html\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Html</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Html code\"><code><span class=\"p\">&lt;</span><span class=\"nt\">ul</span><span class=\"p\">&gt;</span>\n  <span class=\"p\">&lt;</span><span class=\"nt\">li</span><span class=\"p\">&gt;&lt;</span><span class=\"nt\">input</span> <span class=\"na\">type</span><span class=\"o\">=</span><span class=\"s\">&#39;radio&#39;</span> <span class=\"na\">name</span><span class=\"o\">=</span><span class=\"s\">&#39;...&#39;</span><span class=\"p\">&gt;&lt;/</span><span class=\"nt\">li</span><span class=\"p\">&gt;</span>\n  ...\n<span class=\"p\">&lt;/</span><span class=\"nt\">ul</span><span class=\"p\">&gt;</span>\n</code></pre></div>\n<p>For more granular control over the generated markup, you can loop over the\nradio buttons in the template. Assuming a form <code class=\"docutils literal notranslate\">myform</code> with a field\n<code class=\"docutils literal notranslate\">beatles</code> that uses a <code class=\"docutils literal notranslate\">RadioSelect</code> as its widget:</p>\n<div class=\"code-block\" data-language=\"html+django\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Django template</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Django template code\"><code><span class=\"cp\">{%</span> <span class=\"k\">for</span> <span class=\"nv\">radio</span> <span class=\"k\">in</span> <span class=\"nv\">myform.beatles</span> <span class=\"cp\">%}</span>\n<span class=\"p\">&lt;</span><span class=\"nt\">div</span> <span class=\"na\">class</span><span class=\"o\">=</span><span class=\"s\">&quot;myradio&quot;</span><span class=\"p\">&gt;</span>\n    <span class=\"cp\">{{</span> <span class=\"nv\">radio</span> <span class=\"cp\">}}</span>\n<span class=\"p\">&lt;/</span><span class=\"nt\">div</span><span class=\"p\">&gt;</span>\n<span class=\"cp\">{%</span> <span class=\"k\">endfor</span> <span class=\"cp\">%}</span>\n</code></pre></div>\n<p>This would generate the following HTML:</p>\n<div class=\"code-block\" data-language=\"html\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Html</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Html code\"><code><span class=\"p\">&lt;</span><span class=\"nt\">div</span> <span class=\"na\">class</span><span class=\"o\">=</span><span class=\"s\">&quot;myradio&quot;</span><span class=\"p\">&gt;</span>\n    <span class=\"p\">&lt;</span><span class=\"nt\">label</span> <span class=\"na\">for</span><span class=\"o\">=</span><span class=\"s\">&quot;id_beatles_0&quot;</span><span class=\"p\">&gt;&lt;</span><span class=\"nt\">input</span> <span class=\"na\">id</span><span class=\"o\">=</span><span class=\"s\">&quot;id_beatles_0&quot;</span> <span class=\"na\">name</span><span class=\"o\">=</span><span class=\"s\">&quot;beatles&quot;</span> <span class=\"na\">type</span><span class=\"o\">=</span><span class=\"s\">&quot;radio&quot;</span> <span class=\"na\">value</span><span class=\"o\">=</span><span class=\"s\">&quot;john&quot;</span> <span class=\"na\">required</span> <span class=\"p\">/&gt;</span> John<span class=\"p\">&lt;/</span><span class=\"nt\">label</span><span class=\"p\">&gt;</span>\n<span class=\"p\">&lt;/</span><span class=\"nt\">div</span><span class=\"p\">&gt;</span>\n<span class=\"p\">&lt;</span><span class=\"nt\">div</span> <span class=\"na\">class</span><span class=\"o\">=</span><span class=\"s\">&quot;myradio&quot;</span><span class=\"p\">&gt;</span>\n    <span class=\"p\">&lt;</span><span class=\"nt\">label</span> <span class=\"na\">for</span><span class=\"o\">=</span><span class=\"s\">&quot;id_beatles_1&quot;</span><span class=\"p\">&gt;&lt;</span><span class=\"nt\">input</span> <span class=\"na\">id</span><span class=\"o\">=</span><span class=\"s\">&quot;id_beatles_1&quot;</span> <span class=\"na\">name</span><span class=\"o\">=</span><span class=\"s\">&quot;beatles&quot;</span> <span class=\"na\">type</span><span class=\"o\">=</span><span class=\"s\">&quot;radio&quot;</span> <span class=\"na\">value</span><span class=\"o\">=</span><span class=\"s\">&quot;paul&quot;</span> <span class=\"na\">required</span> <span class=\"p\">/&gt;</span> Paul<span class=\"p\">&lt;/</span><span class=\"nt\">label</span><span class=\"p\">&gt;</span>\n<span class=\"p\">&lt;/</span><span class=\"nt\">div</span><span class=\"p\">&gt;</span>\n<span class=\"p\">&lt;</span><span class=\"nt\">div</span> <span class=\"na\">class</span><span class=\"o\">=</span><span class=\"s\">&quot;myradio&quot;</span><span class=\"p\">&gt;</span>\n    <span class=\"p\">&lt;</span><span class=\"nt\">label</span> <span class=\"na\">for</span><span class=\"o\">=</span><span class=\"s\">&quot;id_beatles_2&quot;</span><span class=\"p\">&gt;&lt;</span><span class=\"nt\">input</span> <span class=\"na\">id</span><span class=\"o\">=</span><span class=\"s\">&quot;id_beatles_2&quot;</span> <span class=\"na\">name</span><span class=\"o\">=</span><span class=\"s\">&quot;beatles&quot;</span> <span class=\"na\">type</span><span class=\"o\">=</span><span class=\"s\">&quot;radio&quot;</span> <span class=\"na\">value</span><span class=\"o\">=</span><span class=\"s\">&quot;george&quot;</span> <span class=\"na\">required</span> <span class=\"p\">/&gt;</span> George<span class=\"p\">&lt;/</span><span class=\"nt\">label</span><span class=\"p\">&gt;</span>\n<span class=\"p\">&lt;/</span><span class=\"nt\">div</span><span class=\"p\">&gt;</span>\n<span class=\"p\">&lt;</span><span class=\"nt\">div</span> <span class=\"na\">class</span><span class=\"o\">=</span><span class=\"s\">&quot;myradio&quot;</span><span class=\"p\">&gt;</span>\n    <span class=\"p\">&lt;</span><span class=\"nt\">label</span> <span class=\"na\">for</span><span class=\"o\">=</span><span class=\"s\">&quot;id_beatles_3&quot;</span><span class=\"p\">&gt;&lt;</span><span class=\"nt\">input</span> <span class=\"na\">id</span><span class=\"o\">=</span><span class=\"s\">&quot;id_beatles_3&quot;</span> <span class=\"na\">name</span><span class=\"o\">=</span><span class=\"s\">&quot;beatles&quot;</span> <span class=\"na\">type</span><span class=\"o\">=</span><span class=\"s\">&quot;radio&quot;</span> <span class=\"na\">value</span><span class=\"o\">=</span><span class=\"s\">&quot;ringo&quot;</span> <span class=\"na\">required</span> <span class=\"p\">/&gt;</span> Ringo<span class=\"p\">&lt;/</span><span class=\"nt\">label</span><span class=\"p\">&gt;</span>\n<span class=\"p\">&lt;/</span><span class=\"nt\">div</span><span class=\"p\">&gt;</span>\n</code></pre></div>\n<p>That included the <code class=\"docutils literal notranslate\">&lt;label&gt;</code> tags. To get more granular, you can use each\nradio button’s <code class=\"docutils literal notranslate\">tag</code>, <code class=\"docutils literal notranslate\">choice_label</code> and <code class=\"docutils literal notranslate\">id_for_label</code> attributes.\nFor example, this template…</p>\n<div class=\"code-block\" data-language=\"html+django\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Django template</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Django template code\"><code><span class=\"cp\">{%</span> <span class=\"k\">for</span> <span class=\"nv\">radio</span> <span class=\"k\">in</span> <span class=\"nv\">myform.beatles</span> <span class=\"cp\">%}</span>\n    <span class=\"p\">&lt;</span><span class=\"nt\">label</span> <span class=\"na\">for</span><span class=\"o\">=</span><span class=\"s\">&quot;</span><span class=\"cp\">{{</span> <span class=\"nv\">radio.id_for_label</span> <span class=\"cp\">}}</span><span class=\"s\">&quot;</span><span class=\"p\">&gt;</span>\n        <span class=\"cp\">{{</span> <span class=\"nv\">radio.choice_label</span> <span class=\"cp\">}}</span>\n        <span class=\"p\">&lt;</span><span class=\"nt\">span</span> <span class=\"na\">class</span><span class=\"o\">=</span><span class=\"s\">&quot;radio&quot;</span><span class=\"p\">&gt;</span><span class=\"cp\">{{</span> <span class=\"nv\">radio.tag</span> <span class=\"cp\">}}</span><span class=\"p\">&lt;/</span><span class=\"nt\">span</span><span class=\"p\">&gt;</span>\n    <span class=\"p\">&lt;/</span><span class=\"nt\">label</span><span class=\"p\">&gt;</span>\n<span class=\"cp\">{%</span> <span class=\"k\">endfor</span> <span class=\"cp\">%}</span>\n</code></pre></div>\n<p>…will result in the following HTML:</p>\n<div class=\"code-block\" data-language=\"html\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Html</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Html code\"><code><span class=\"p\">&lt;</span><span class=\"nt\">label</span> <span class=\"na\">for</span><span class=\"o\">=</span><span class=\"s\">&quot;id_beatles_0&quot;</span><span class=\"p\">&gt;</span>\n    John\n    <span class=\"p\">&lt;</span><span class=\"nt\">span</span> <span class=\"na\">class</span><span class=\"o\">=</span><span class=\"s\">&quot;radio&quot;</span><span class=\"p\">&gt;&lt;</span><span class=\"nt\">input</span> <span class=\"na\">id</span><span class=\"o\">=</span><span class=\"s\">&quot;id_beatles_0&quot;</span> <span class=\"na\">name</span><span class=\"o\">=</span><span class=\"s\">&quot;beatles&quot;</span> <span class=\"na\">type</span><span class=\"o\">=</span><span class=\"s\">&quot;radio&quot;</span> <span class=\"na\">value</span><span class=\"o\">=</span><span class=\"s\">&quot;john&quot;</span> <span class=\"na\">required</span> <span class=\"p\">/&gt;&lt;/</span><span class=\"nt\">span</span><span class=\"p\">&gt;</span>\n<span class=\"p\">&lt;/</span><span class=\"nt\">label</span><span class=\"p\">&gt;</span>\n\n<span class=\"p\">&lt;</span><span class=\"nt\">label</span> <span class=\"na\">for</span><span class=\"o\">=</span><span class=\"s\">&quot;id_beatles_1&quot;</span><span class=\"p\">&gt;</span>\n    Paul\n    <span class=\"p\">&lt;</span><span class=\"nt\">span</span> <span class=\"na\">class</span><span class=\"o\">=</span><span class=\"s\">&quot;radio&quot;</span><span class=\"p\">&gt;&lt;</span><span class=\"nt\">input</span> <span class=\"na\">id</span><span class=\"o\">=</span><span class=\"s\">&quot;id_beatles_1&quot;</span> <span class=\"na\">name</span><span class=\"o\">=</span><span class=\"s\">&quot;beatles&quot;</span> <span class=\"na\">type</span><span class=\"o\">=</span><span class=\"s\">&quot;radio&quot;</span> <span class=\"na\">value</span><span class=\"o\">=</span><span class=\"s\">&quot;paul&quot;</span> <span class=\"na\">required</span> <span class=\"p\">/&gt;&lt;/</span><span class=\"nt\">span</span><span class=\"p\">&gt;</span>\n<span class=\"p\">&lt;/</span><span class=\"nt\">label</span><span class=\"p\">&gt;</span>\n\n<span class=\"p\">&lt;</span><span class=\"nt\">label</span> <span class=\"na\">for</span><span class=\"o\">=</span><span class=\"s\">&quot;id_beatles_2&quot;</span><span class=\"p\">&gt;</span>\n    George\n    <span class=\"p\">&lt;</span><span class=\"nt\">span</span> <span class=\"na\">class</span><span class=\"o\">=</span><span class=\"s\">&quot;radio&quot;</span><span class=\"p\">&gt;&lt;</span><span class=\"nt\">input</span> <span class=\"na\">id</span><span class=\"o\">=</span><span class=\"s\">&quot;id_beatles_2&quot;</span> <span class=\"na\">name</span><span class=\"o\">=</span><span class=\"s\">&quot;beatles&quot;</span> <span class=\"na\">type</span><span class=\"o\">=</span><span class=\"s\">&quot;radio&quot;</span> <span class=\"na\">value</span><span class=\"o\">=</span><span class=\"s\">&quot;george&quot;</span> <span class=\"na\">required</span> <span class=\"p\">/&gt;&lt;/</span><span class=\"nt\">span</span><span class=\"p\">&gt;</span>\n<span class=\"p\">&lt;/</span><span class=\"nt\">label</span><span class=\"p\">&gt;</span>\n\n<span class=\"p\">&lt;</span><span class=\"nt\">label</span> <span class=\"na\">for</span><span class=\"o\">=</span><span class=\"s\">&quot;id_beatles_3&quot;</span><span class=\"p\">&gt;</span>\n    Ringo\n    <span class=\"p\">&lt;</span><span class=\"nt\">span</span> <span class=\"na\">class</span><span class=\"o\">=</span><span class=\"s\">&quot;radio&quot;</span><span class=\"p\">&gt;&lt;</span><span class=\"nt\">input</span> <span class=\"na\">id</span><span class=\"o\">=</span><span class=\"s\">&quot;id_beatles_3&quot;</span> <span class=\"na\">name</span><span class=\"o\">=</span><span class=\"s\">&quot;beatles&quot;</span> <span class=\"na\">type</span><span class=\"o\">=</span><span class=\"s\">&quot;radio&quot;</span> <span class=\"na\">value</span><span class=\"o\">=</span><span class=\"s\">&quot;ringo&quot;</span> <span class=\"na\">required</span> <span class=\"p\">/&gt;&lt;/</span><span class=\"nt\">span</span><span class=\"p\">&gt;</span>\n<span class=\"p\">&lt;/</span><span class=\"nt\">label</span><span class=\"p\">&gt;</span>\n</code></pre></div>\n<p>If you decide not to loop over the radio buttons – e.g., if your template\nsimply includes <code class=\"docutils literal notranslate\">{{ myform.beatles }}</code> – they’ll be output in a <code class=\"docutils literal notranslate\">&lt;ul&gt;</code>\nwith <code class=\"docutils literal notranslate\">&lt;li&gt;</code> tags, as above.</p>\n<p>The outer <code class=\"docutils literal notranslate\">&lt;ul&gt;</code> container receives the <code class=\"docutils literal notranslate\">id</code> attribute of the widget,\nif defined, or <a class=\"reference internal\" href=\"/es/1.10/ref/forms/api/#django.forms.BoundField.auto_id\" title=\"django.forms.BoundField.auto_id\"><code class=\"xref py py-attr docutils literal notranslate\">BoundField.auto_id</code></a> otherwise.</p>\n<p>When looping over the radio buttons, the <code class=\"docutils literal notranslate\">label</code> and <code class=\"docutils literal notranslate\">input</code> tags include\n<code class=\"docutils literal notranslate\">for</code> and <code class=\"docutils literal notranslate\">id</code> attributes, respectively. Each radio button has an\n<code class=\"docutils literal notranslate\">id_for_label</code> attribute to output the element’s ID.</p>\n</dd></dl>\n\n</section>\n<section id=\"checkboxselectmultiple\">\n<h4><code class=\"docutils literal notranslate\">CheckboxSelectMultiple</code><a class=\"heading-anchor\" href=\"#checkboxselectmultiple\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.CheckboxSelectMultiple\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">CheckboxSelectMultiple</span><a class=\"heading-anchor\" href=\"#django.forms.CheckboxSelectMultiple\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Similar to <a class=\"reference internal\" href=\"#django.forms.SelectMultiple\" title=\"django.forms.SelectMultiple\"><code class=\"xref py py-class docutils literal notranslate\">SelectMultiple</code></a>, but rendered as a list of check\nbuttons:</p>\n<div class=\"code-block\" data-language=\"html\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Html</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Html code\"><code><span class=\"p\">&lt;</span><span class=\"nt\">ul</span><span class=\"p\">&gt;</span>\n  <span class=\"p\">&lt;</span><span class=\"nt\">li</span><span class=\"p\">&gt;&lt;</span><span class=\"nt\">input</span> <span class=\"na\">type</span><span class=\"o\">=</span><span class=\"s\">&#39;checkbox&#39;</span> <span class=\"na\">name</span><span class=\"o\">=</span><span class=\"s\">&#39;...&#39;</span> <span class=\"p\">&gt;&lt;/</span><span class=\"nt\">li</span><span class=\"p\">&gt;</span>\n  ...\n<span class=\"p\">&lt;/</span><span class=\"nt\">ul</span><span class=\"p\">&gt;</span>\n</code></pre></div>\n<p>The outer <code class=\"docutils literal notranslate\">&lt;ul&gt;</code> container receives the <code class=\"docutils literal notranslate\">id</code> attribute of the widget,\nif defined, or <a class=\"reference internal\" href=\"/es/1.10/ref/forms/api/#django.forms.BoundField.auto_id\" title=\"django.forms.BoundField.auto_id\"><code class=\"xref py py-attr docutils literal notranslate\">BoundField.auto_id</code></a> otherwise.</p>\n</dd></dl>\n\n<p>Like <a class=\"reference internal\" href=\"#django.forms.RadioSelect\" title=\"django.forms.RadioSelect\"><code class=\"xref py py-class docutils literal notranslate\">RadioSelect</code></a>, you can loop over the individual checkboxes for the\nwidget’s choices. Unlike <a class=\"reference internal\" href=\"#django.forms.RadioSelect\" title=\"django.forms.RadioSelect\"><code class=\"xref py py-class docutils literal notranslate\">RadioSelect</code></a>, the checkboxes won’t include the\n<code class=\"docutils literal notranslate\">required</code> HTML attribute if the field is required because browser validation\nwould require all checkboxes to be checked instead of at least one.</p>\n<p>When looping over the checkboxes, the <code class=\"docutils literal notranslate\">label</code> and <code class=\"docutils literal notranslate\">input</code> tags include\n<code class=\"docutils literal notranslate\">for</code> and <code class=\"docutils literal notranslate\">id</code> attributes, respectively. Each checkbox has an\n<code class=\"docutils literal notranslate\">id_for_label</code> attribute to output the element’s ID.</p>\n</section>\n</section>\n<section id=\"file-upload-widgets\">\n<span id=\"id5\"></span><h3>File upload widgets<a class=\"heading-anchor\" href=\"#file-upload-widgets\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"fileinput\">\n<h4><code class=\"docutils literal notranslate\">FileInput</code><a class=\"heading-anchor\" href=\"#fileinput\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.FileInput\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">FileInput</span><a class=\"heading-anchor\" href=\"#django.forms.FileInput\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>File upload input: <code class=\"docutils literal notranslate\">&lt;input type='file' ...&gt;</code></p>\n</dd></dl>\n\n</section>\n<section id=\"clearablefileinput\">\n<h4><code class=\"docutils literal notranslate\">ClearableFileInput</code><a class=\"heading-anchor\" href=\"#clearablefileinput\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.ClearableFileInput\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">ClearableFileInput</span><a class=\"heading-anchor\" href=\"#django.forms.ClearableFileInput\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>File upload input: <code class=\"docutils literal notranslate\">&lt;input type='file' ...&gt;</code>, with an additional checkbox\ninput to clear the field’s value, if the field is not required and has\ninitial data.</p>\n</dd></dl>\n\n</section>\n</section>\n<section id=\"composite-widgets\">\n<span id=\"id6\"></span><h3>Composite widgets<a class=\"heading-anchor\" href=\"#composite-widgets\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<section id=\"multiplehiddeninput\">\n<h4><code class=\"docutils literal notranslate\">MultipleHiddenInput</code><a class=\"heading-anchor\" href=\"#multiplehiddeninput\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.MultipleHiddenInput\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">MultipleHiddenInput</span><a class=\"heading-anchor\" href=\"#django.forms.MultipleHiddenInput\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Multiple <code class=\"docutils literal notranslate\">&lt;input type='hidden' ...&gt;</code> widgets.</p>\n<p>A widget that handles multiple hidden widgets for fields that have a list\nof values.</p>\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.forms.MultipleHiddenInput.choices\">\n<span class=\"sig-name descname\">choices</span><a class=\"heading-anchor\" href=\"#django.forms.MultipleHiddenInput.choices\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>This attribute is optional when the form field does not have a\n<code class=\"docutils literal notranslate\">choices</code> attribute. If it does, it will override anything you set\nhere when the attribute is updated on the <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.Field\" title=\"django.forms.Field\"><code class=\"xref py py-class docutils literal notranslate\">Field</code></a>.</p>\n</dd></dl>\n\n</dd></dl>\n\n</section>\n<section id=\"splitdatetimewidget\">\n<h4><code class=\"docutils literal notranslate\">SplitDateTimeWidget</code><a class=\"heading-anchor\" href=\"#splitdatetimewidget\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.SplitDateTimeWidget\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">SplitDateTimeWidget</span><a class=\"heading-anchor\" href=\"#django.forms.SplitDateTimeWidget\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Wrapper (using <a class=\"reference internal\" href=\"#django.forms.MultiWidget\" title=\"django.forms.MultiWidget\"><code class=\"xref py py-class docutils literal notranslate\">MultiWidget</code></a>) around two widgets: <a class=\"reference internal\" href=\"#django.forms.DateInput\" title=\"django.forms.DateInput\"><code class=\"xref py py-class docutils literal notranslate\">DateInput</code></a>\nfor the date, and <a class=\"reference internal\" href=\"#django.forms.TimeInput\" title=\"django.forms.TimeInput\"><code class=\"xref py py-class docutils literal notranslate\">TimeInput</code></a> for the time. Must be used with\n<a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.SplitDateTimeField\" title=\"django.forms.SplitDateTimeField\"><code class=\"xref py py-class docutils literal notranslate\">SplitDateTimeField</code></a> rather than <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.DateTimeField\" title=\"django.forms.DateTimeField\"><code class=\"xref py py-class docutils literal notranslate\">DateTimeField</code></a>.</p>\n<p><code class=\"docutils literal notranslate\">SplitDateTimeWidget</code> has two optional attributes:</p>\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.forms.SplitDateTimeWidget.date_format\">\n<span class=\"sig-name descname\">date_format</span><a class=\"heading-anchor\" href=\"#django.forms.SplitDateTimeWidget.date_format\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Similar to <a class=\"reference internal\" href=\"#django.forms.DateInput.format\" title=\"django.forms.DateInput.format\"><code class=\"xref py py-attr docutils literal notranslate\">DateInput.format</code></a></p>\n</dd></dl>\n\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.forms.SplitDateTimeWidget.time_format\">\n<span class=\"sig-name descname\">time_format</span><a class=\"heading-anchor\" href=\"#django.forms.SplitDateTimeWidget.time_format\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Similar to <a class=\"reference internal\" href=\"#django.forms.TimeInput.format\" title=\"django.forms.TimeInput.format\"><code class=\"xref py py-attr docutils literal notranslate\">TimeInput.format</code></a></p>\n</dd></dl>\n\n</dd></dl>\n\n</section>\n<section id=\"splithiddendatetimewidget\">\n<h4><code class=\"docutils literal notranslate\">SplitHiddenDateTimeWidget</code><a class=\"heading-anchor\" href=\"#splithiddendatetimewidget\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.SplitHiddenDateTimeWidget\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">SplitHiddenDateTimeWidget</span><a class=\"heading-anchor\" href=\"#django.forms.SplitHiddenDateTimeWidget\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Similar to <a class=\"reference internal\" href=\"#django.forms.SplitDateTimeWidget\" title=\"django.forms.SplitDateTimeWidget\"><code class=\"xref py py-class docutils literal notranslate\">SplitDateTimeWidget</code></a>, but uses <a class=\"reference internal\" href=\"#django.forms.HiddenInput\" title=\"django.forms.HiddenInput\"><code class=\"xref py py-class docutils literal notranslate\">HiddenInput</code></a> for\nboth date and time.</p>\n</dd></dl>\n\n</section>\n<section id=\"selectdatewidget\">\n<h4><code class=\"docutils literal notranslate\">SelectDateWidget</code><a class=\"heading-anchor\" href=\"#selectdatewidget\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h4>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.forms.SelectDateWidget\">\n<em class=\"property\"><span class=\"k\">class</span> </em><span class=\"sig-name descname\">SelectDateWidget</span><a class=\"heading-anchor\" href=\"#django.forms.SelectDateWidget\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>Wrapper around three <a class=\"reference internal\" href=\"#django.forms.Select\" title=\"django.forms.Select\"><code class=\"xref py py-class docutils literal notranslate\">Select</code></a> widgets: one each for\nmonth, day, and year.</p>\n<p>Takes several optional arguments:</p>\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.forms.SelectDateWidget.years\">\n<span class=\"sig-name descname\">years</span><a class=\"heading-anchor\" href=\"#django.forms.SelectDateWidget.years\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>An optional list/tuple of years to use in the «year» select box.\nThe default is a list containing the current year and the next 9 years.</p>\n</dd></dl>\n\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.forms.SelectDateWidget.months\">\n<span class=\"sig-name descname\">months</span><a class=\"heading-anchor\" href=\"#django.forms.SelectDateWidget.months\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>An optional dict of months to use in the «months» select box.</p>\n<p>The keys of the dict correspond to the month number (1-indexed) and\nthe values are the displayed months:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>MONTHS <span class=\"o\">=</span> <span class=\"p\">{</span>\n    <span class=\"mi\">1</span><span class=\"p\">:</span>_<span class=\"p\">(</span><span class=\"s1\">&#39;jan&#39;</span><span class=\"p\">),</span> <span class=\"mi\">2</span><span class=\"p\">:</span>_<span class=\"p\">(</span><span class=\"s1\">&#39;feb&#39;</span><span class=\"p\">),</span> <span class=\"mi\">3</span><span class=\"p\">:</span>_<span class=\"p\">(</span><span class=\"s1\">&#39;mar&#39;</span><span class=\"p\">),</span> <span class=\"mi\">4</span><span class=\"p\">:</span>_<span class=\"p\">(</span><span class=\"s1\">&#39;apr&#39;</span><span class=\"p\">),</span>\n    <span class=\"mi\">5</span><span class=\"p\">:</span>_<span class=\"p\">(</span><span class=\"s1\">&#39;may&#39;</span><span class=\"p\">),</span> <span class=\"mi\">6</span><span class=\"p\">:</span>_<span class=\"p\">(</span><span class=\"s1\">&#39;jun&#39;</span><span class=\"p\">),</span> <span class=\"mi\">7</span><span class=\"p\">:</span>_<span class=\"p\">(</span><span class=\"s1\">&#39;jul&#39;</span><span class=\"p\">),</span> <span class=\"mi\">8</span><span class=\"p\">:</span>_<span class=\"p\">(</span><span class=\"s1\">&#39;aug&#39;</span><span class=\"p\">),</span>\n    <span class=\"mi\">9</span><span class=\"p\">:</span>_<span class=\"p\">(</span><span class=\"s1\">&#39;sep&#39;</span><span class=\"p\">),</span> <span class=\"mi\">10</span><span class=\"p\">:</span>_<span class=\"p\">(</span><span class=\"s1\">&#39;oct&#39;</span><span class=\"p\">),</span> <span class=\"mi\">11</span><span class=\"p\">:</span>_<span class=\"p\">(</span><span class=\"s1\">&#39;nov&#39;</span><span class=\"p\">),</span> <span class=\"mi\">12</span><span class=\"p\">:</span>_<span class=\"p\">(</span><span class=\"s1\">&#39;dec&#39;</span><span class=\"p\">)</span>\n<span class=\"p\">}</span>\n</code></pre></div>\n</dd></dl>\n\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.forms.SelectDateWidget.empty_label\">\n<span class=\"sig-name descname\">empty_label</span><a class=\"heading-anchor\" href=\"#django.forms.SelectDateWidget.empty_label\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd><p>If the <a class=\"reference internal\" href=\"/es/1.10/ref/forms/fields/#django.forms.DateField\" title=\"django.forms.DateField\"><code class=\"xref py py-class docutils literal notranslate\">DateField</code></a> is not required,\n<a class=\"reference internal\" href=\"#django.forms.SelectDateWidget\" title=\"django.forms.SelectDateWidget\"><code class=\"xref py py-class docutils literal notranslate\">SelectDateWidget</code></a> will have an empty choice at the top of the\nlist (which is <code class=\"docutils literal notranslate\">---</code> by default). You can change the text of this\nlabel with the <code class=\"docutils literal notranslate\">empty_label</code> attribute. <code class=\"docutils literal notranslate\">empty_label</code> can be a\n<code class=\"docutils literal notranslate\">string</code>, <code class=\"docutils literal notranslate\">list</code>, or <code class=\"docutils literal notranslate\">tuple</code>. When a string is used, all select\nboxes will each have an empty choice with this label. If <code class=\"docutils literal notranslate\">empty_label</code>\nis a <code class=\"docutils literal notranslate\">list</code> or <code class=\"docutils literal notranslate\">tuple</code> of 3 string elements, the select boxes will\nhave their own custom label. The labels should be in this order\n<code class=\"docutils literal notranslate\">('year_label', 'month_label', 'day_label')</code>.</p>\n<div class=\"code-block\" data-language=\"python\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Python</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Python code\"><code><span class=\"c1\"># A custom empty label with string</span>\nfield1 <span class=\"o\">=</span> forms<span class=\"o\">.</span>DateField<span class=\"p\">(</span>widget<span class=\"o\">=</span>SelectDateWidget<span class=\"p\">(</span>empty_label<span class=\"o\">=</span><span class=\"s2\">&quot;Nothing&quot;</span><span class=\"p\">))</span>\n\n<span class=\"c1\"># A custom empty label with tuple</span>\nfield1 <span class=\"o\">=</span> forms<span class=\"o\">.</span>DateField<span class=\"p\">(</span>\n    widget<span class=\"o\">=</span>SelectDateWidget<span class=\"p\">(</span>\n        empty_label<span class=\"o\">=</span><span class=\"p\">(</span><span class=\"s2\">&quot;Choose Year&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;Choose Month&quot;</span><span class=\"p\">,</span> <span class=\"s2\">&quot;Choose Day&quot;</span><span class=\"p\">),</span>\n    <span class=\"p\">),</span>\n<span class=\"p\">)</span>\n</code></pre></div>\n</dd></dl>\n\n<aside class=\"version-note version-changed\" data-version=\"1.9\" role=\"note\">\n<p class=\"version-note-title\">Changed in Django 1.9</p><p>This widget used to be located in the <code class=\"docutils literal notranslate\">django.forms.extras.widgets</code>\npackage. It is now defined in <code class=\"docutils literal notranslate\">django.forms.widgets</code> and like the\nother widgets it can be imported directly from <code class=\"docutils literal notranslate\">django.forms</code>.</p>\n</aside>\n</dd></dl>\n\n</section>\n</section>\n</section>","rootId":"module-django.forms.widgets","toc":[{"title":"Specifying widgets","anchor":"specifying-widgets","children":[]},{"title":"Setting arguments for widgets","anchor":"setting-arguments-for-widgets","children":[]},{"title":"Widgets inheriting from the Select widget","anchor":"widgets-inheriting-from-the-select-widget","children":[]},{"title":"Customizing widget instances","anchor":"customizing-widget-instances","children":[{"title":"Styling widget instances","anchor":"styling-widget-instances","children":[]},{"title":"Styling widget classes","anchor":"styling-widget-classes","children":[]}]},{"title":"Base widget classes","anchor":"base-widget-classes","children":[{"title":"Widget","anchor":"widget","children":[]},{"title":"MultiWidget","anchor":"multiwidget","children":[]}]},{"title":"Built-in widgets","anchor":"built-in-widgets","children":[{"title":"Widgets handling input of text","anchor":"widgets-handling-input-of-text","children":[{"title":"TextInput","anchor":"textinput","children":[]},{"title":"NumberInput","anchor":"numberinput","children":[]},{"title":"EmailInput","anchor":"emailinput","children":[]},{"title":"URLInput","anchor":"urlinput","children":[]},{"title":"PasswordInput","anchor":"passwordinput","children":[]},{"title":"HiddenInput","anchor":"hiddeninput","children":[]},{"title":"DateInput","anchor":"dateinput","children":[]},{"title":"DateTimeInput","anchor":"datetimeinput","children":[]},{"title":"TimeInput","anchor":"timeinput","children":[]},{"title":"Textarea","anchor":"textarea","children":[]}]},{"title":"Selector and checkbox widgets","anchor":"selector-and-checkbox-widgets","children":[{"title":"CheckboxInput","anchor":"checkboxinput","children":[]},{"title":"Select","anchor":"select","children":[]},{"title":"NullBooleanSelect","anchor":"nullbooleanselect","children":[]},{"title":"SelectMultiple","anchor":"selectmultiple","children":[]},{"title":"RadioSelect","anchor":"radioselect","children":[]},{"title":"CheckboxSelectMultiple","anchor":"checkboxselectmultiple","children":[]}]},{"title":"File upload widgets","anchor":"file-upload-widgets","children":[{"title":"FileInput","anchor":"fileinput","children":[]},{"title":"ClearableFileInput","anchor":"clearablefileinput","children":[]}]},{"title":"Composite widgets","anchor":"composite-widgets","children":[{"title":"MultipleHiddenInput","anchor":"multiplehiddeninput","children":[]},{"title":"SplitDateTimeWidget","anchor":"splitdatetimewidget","children":[]},{"title":"SplitHiddenDateTimeWidget","anchor":"splithiddendatetimewidget","children":[]},{"title":"SelectDateWidget","anchor":"selectdatewidget","children":[]}]}]}],"breadcrumbs":[{"docname":"ref/index","title":"API Reference","url":"/es/1.10/ref/"},{"docname":"ref/forms/index","title":"Forms","url":"/es/1.10/ref/forms/"}],"prev":{"docname":"ref/forms/formsets","title":"Formset Functions","url":"/es/1.10/ref/forms/formsets/"},"next":{"docname":"ref/forms/validation","title":"Form and field validation","url":"/es/1.10/ref/forms/validation/"},"formats":{"html":"/es/1.10/ref/forms/widgets/","markdown":"/es/1.10/ref/forms/widgets.md","json":"/es/1.10/ref/forms/widgets.json"},"source":"https://github.com/django/django/blob/stable/1.10.x/docs/ref/forms/widgets.txt","official":"https://docs.djangoproject.com/es/1.10/ref/forms/widgets/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0","1.11","1.10","1.9"],"inLocales":["en","fr","ja","id","pt-br","es","el","pl"]}