#22502: Datetime fields break empty form validation on first attempt (but not
second)
--------------------------+--------------------------------------
     Reporter:  melinath  |                    Owner:  nobody
         Type:  Bug       |                   Status:  new
    Component:  Forms     |                  Version:  1.7-beta-2
     Severity:  Normal    |               Resolution:
     Keywords:            |             Triage Stage:  Unreviewed
    Has patch:  0         |      Needs documentation:  0
  Needs tests:  0         |  Patch needs improvement:  0
Easy pickings:  0         |                    UI/UX:  0
--------------------------+--------------------------------------

Comment (by melinath):

 Nope, this is definitely a django bug. The problem is that the hidden
 widget used to keep track of the initial value preserves the microsecond
 information, while the datetime widget discards it. Solution to this bug
 should then be to either display the microseconds (see also #12139?) or
 (what I'd prefer) perform the same conversion on the data for the hidden
 input as for the displayed input.

 Note that there is a race condition: it is possible (though unlikely) for
 the displayed input and hidden input to be different seconds, as well,
 since ```BoundField.value()``` is called twice and the results not cached.

 Regarding the first vs. second page render: On the second page render,
 since the form is now bound, ```BoundField.value()``` returns the
 submitted data for the hidden initial value (as well as the displayed
 value) instead of the old initial value. Which seems a bit odd, since it
 means that data changes on any field with show_hidden_initial will first
 cause validation errors and then (on resubmit) simply be ignored. (That
 being said, I don't know that there would be a better way to handle this
 kind of data.)

 (P.S. this bug is maybe related to #12139?)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22502#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.acf7ea4a69d429bdb620f8f8ead05c57%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to