Changes between Initial Version and Version 2 of Ticket #28090


Ignore:
Timestamp:
Apr 20, 2017, 7:15:31 AM (7 years ago)
Author:
Tim Graham
Comment:

Bisected to 6d8979f4c2fbfb9fd5db92acd72489cbbcbdd5d1. It happens in forms outside the admin also. I think it's a duplicate of #28075 -- the <select> value is inadvertently localized just like in that ticket.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28090

    • Property Cc ygan@… added
    • Property Component UncategorizedForms
    • Property Resolutionduplicate
    • Property Triage Stage UnreviewedAccepted
    • Property Status newclosed
    • Property Summary TimeField rendering in admin formsTimeField's value incorrectly localized in forms
  • Ticket #28090 – Description

    initial v2  
    1 When passing a datetime.Time instance to the choices parameter in a TimeField, the admin template converts it to a human readable form. Eg Time(0, 0) gets converted to "midnight", Time(1, 30) gets converted to 1:30 a.m. In Django 1.10 it gets formatted as 00:00:00 and 01:30:00 respectively.
     1When passing a `datetime.time` instance to the choices parameter in a `TimeField`, the admin template converts it to a human readable form. For example, `time(0, 0)` is converted to "midnight", `time(1, 30)` is converted to 1:30 a.m. In Django 1.10, it gets formatted as 00:00:00 and 01:30:00 respectively.
    22
    33An example of the choices I pass in to the constructor is:
     
    55{{{
    66[
    7     (datetime.Time(0, 0), '00:00'),
    8     (datetime.Time(0, 30), '00:30'),
    9     (datetime.Time(1, 0), '01:00'),
     7    (datetime.time(0, 0), '00:00'),
     8    (datetime.time(0, 30), '00:30'),
     9    (datetime.time(1, 0), '01:00'),
    1010    ....,
    11     (datetime.Time(23, 30), '23:30')
     11    (datetime.time(23, 30), '23:30')
    1212]
    1313}}}
Back to Top