#14030: Use F() objects in aggregates(), annotates() and values()
-------------------------------------+-------------------------------------
     Reporter:  delfick              |                    Owner:  smeatonj
         Type:  New feature          |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:  aggregate, annotate  |      Needs documentation:  0
    Has patch:  1                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by smeatonj):

 All of those scenarios in your gist will be covered, yes. There is going
 to be some overlap with the new Lookups/Transforms API and this patch, but
 I *think* we can also get them to work together, since they both support
 the Query Expression API. In particular, your datepart example could be:

 {{{
 .annotate(month=F('the_date__month'))
 # or
 .annotate(month=Extract('the_date', MONTH))
 }}}

 Of course this requires implementing the Extract() expression, and
 registering it with the DateField transform. Also, F() expressions don't
 yet support the __transform__lookup syntax, but that'd be the next thing
 I'd implement once (if) this patch is committed.

 The other scenarios you bring up are a lot simpler:

 {{{
 class Coalesce(Func):
     function = 'COALESCE'
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/14030#comment:44>
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/065.595f0e89a2662bca6267a885f59af59a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to