﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33113	Add example to documentation of a DateInput with input_type='date'	dennisvang	Samriddha Kumar Tripathi	"== Rationale

By default, the [https://docs.djangoproject.com/en/3.2/ref/forms/widgets/#dateinput forms.widgets.DateInput] widget renders as a simple text field.

However, a ""date picker"", like [https://github.com/django/django/blob/stable/3.2.x/django/contrib/admin/widgets.py#L49 the one implemented in contrib.admin] is often much more convenient. 

Fortunately it is now possible to take advantage of the browser's built-in date picker, using the HTML [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date <input type='date'>] element.

The only problem is that, although the default `DateInput` can be easily modified to use the `<input type='date'>` element, this may not be so obvious to people unfamiliar with the inner workings of Django (e.g. [https://github.com/django/django/blob/stable/3.2.x/django/forms/widgets.py#L288 forms.widgets.Input.input_type]). 

Moreover, some people may not even know the HTML `type='date'` exists, nor that [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#browser_compatibility browsers have built-in date pickers].

== Request

I believe it would be very helpful if the documentation included an example, like [https://code.djangoproject.com/ticket/33100#comment:6 these two provided by Tim Graham in ticket #33100]:


{{{
class DateInput(forms.DateInput):
    input_type = 'date'
}}}

or 

{{{
DateInput(attrs={'type': 'date'})
}}}




This has the additional advantage of documenting the use of the `forms.widgets.Input.input_type` attribute, which [https://github.com/django/django/blob/stable/3.2.x/docs/ref/forms/widgets.txt#L507 appears in the documentation] but is not mentioned explicitly in the text, as far as I see.

If necessary, I would be willing to prepare a pull request for this.

"	Cleanup/optimization	closed	Documentation	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
