#23803: DateField returns datetime if SQLite field is created as TIMESTAMP
-------------------------------------+-------------------------------------
Reporter: me21 | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by mrbox):
* needs_better_patch: => 0
* version: 1.6 => master
* stage: Unreviewed => Accepted
* needs_tests: => 0
* needs_docs: => 0
Comment:
I agree that described behaviour exists. Steps to reproduce:
1. Create model like this:
{{{
class DateTimeModel(models.Model):
date_field = models.DateField()
}}}
2. makemigrations & migrate
3. Change manually type of date_field column to TIMESTAMP
4. Add an entry with TIMESTAMP for example `2010-08-28T13:40:02.200`
5. In django shell execute DateTimeModel.objects.first().date_field
6. Output is datetime.datetime(2010, 8, 28, 13, 40, 2, 200000,
tzinfo=<UTC>)
However I'm not sure what should be correct behaviour- should DateField
parse this as date or rather throw an exception?
--
Ticket URL: <https://code.djangoproject.com/ticket/23803#comment:1>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/062.240170593ad7f69b9881b57f2cd91313%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.