#29767: Django ORM: Cast between datetime and date
-----------------------------------------+------------------------
               Reporter:  Rémy Hubscher  |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  2.1
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 While using with Annotations and Cast I realized that the casting between
 datetime and date with SQLite3 was kinda broken.


 {{{
 Cast("datetime_field", DateField())
 }}}
  is transformed into
 {{{
 CAST("datetime_field" AS TEXT)
 }}}
  rather than for instance
 {{{
 substr(CAST(datetime_field AS TEXT),0,11)
 }}}

 I was able to use extra to fix that and run the query. However I would
 like to fix this.

 This is especially useful for my usecase where I want to GROUP BY the
 annotated value.

 I wrote a test for it https://github.com/django/django/pull/10387/files

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29767>
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/048.17625bd75d815eee6fefd6c4d46786da%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to