The datetimes in the POST are created using timezone.now() (and I have USE_TZ = True)
I'm wondering if someone encountered this issue before, or if there is already a ticket submitted. I personally failed to find one, but maybe I just suck at searching Trac.
2012/11/27 Ion Scerbatiuc <delin...@gmail.com>The datetimes in the POST are created using timezone.now() (and I have USE_TZ = True)The POST data simulates the values entered by the user in the form. It should contain naive datetimes in local time.
Actually, to be realistic, it should contain strings representing naive date times, because that's what will be POST-ed by a HTML form. But using a datetime object works too.
I'm wondering if someone encountered this issue before, or if there is already a ticket submitted. I personally failed to find one, but maybe I just suck at searching Trac.As far as I know, you're the first one to report this problem.We have two options:- improve the code so an aware datetime is accepted as form input, and passed-through unchanged;- document this as a known pitfall.Could you file a ticket in Trac? I'll take a look as soon as possible.
--
Aymeric.
Actually, to be realistic, it should contain strings representing naive date times, because that's what will be POST-ed by a HTML form. But using a datetime object works too.
I'm not 100% sure that the datetimes received in the POST should represent naive date times. I mean there might be use cases when they represent aware datetimes:
- there is a custom widget that allows the user to specify the timezone
- the data is coming through a REST API and you have a form handling the validation
- ...