#21470 closed New feature (wontfix)

Make DateInput and DateTimeInput render as a html5 field type="date" and type="datetime"

Reported by: troygrosfield Owned by: nobody
Component: Forms Version: 1.6
Severity: Normal Keywords: datetime, date, widgets, inputs
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

One of my favorite changes to django 1.6 was making all the form inputs render to html5 types:

The default widgets for EmailField, URLField, IntegerField, FloatField and DecimalField 
use the new type attributes available in HTML5 (type='email', type='url', type='number'). 
Note that due to erratic support of the number input type with localized numbers in 
current browsers, Django only uses it when numeric fields are not localized.

So the big question here is why was the date and datetime fields left out if they all just fall back to rendering as text inputs anyway?

The untested change I think is simply:

class DateInput(DateTimeBaseInput):
    format_key = 'DATE_INPUT_FORMATS'
    input_type = 'date'

and

class DateTimeInput(DateTimeBaseInput):
    format_key = 'DATETIME_INPUT_FORMATS'
    input_type = 'datetime'

Change History (3)

comment:1 Changed 17 months ago by troygrosfield

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Created the pull request for this change:

comment:2 Changed 17 months ago by timo

I believe this was intentionally omitted. Have you read the discussion on the ticket?

comment:3 Changed 17 months ago by troygrosfield

  • Resolution set to wontfix
  • Status changed from new to closed

I figured there was a reason for it, but I didn't see the discussion on the ticket for it. Thanks for the heads up timo.

Note: See TracTickets for help on using tickets.
Back to Top