So how would an query like this be written, with the new Query Expression 
API? Where a count of events by day is required but the date column is 
datetime?

Triggers.objects.all().extra({"day": "date_trunc('day', date)"}).values_list
('name', 'severity', 'day').annotate(total=Count('severity'))





On Wednesday, December 9, 2015 at 8:07:28 PM UTC-5, Russell Keith-Magee 
wrote:
>
> Hi Luis,
>
> On Thu, Dec 10, 2015 at 7:10 AM, Luis Masuelli <luisfm...@gmail.com 
> <javascript:>> wrote:
>
>> When I see the docs (
>> https://docs.djangoproject.com/en/1.8/ref/models/querysets/#extra), I 
>> notice .extra will be deprecated and removed. Is there a plan for the 
>> replacement? As I see it, limiting ourselves to using Manager.raw() is not 
>> a good idea, since you cannot work anymore on a RawQueryset object (as you 
>> can work on any Queryset object you called .extra). So my question is: Is 
>> there a good replacement for .extra being planned?
>>
>
> Yes - the Query Expression API.
>
> https://docs.djangoproject.com/en/1.9/ref/models/expressions/
>
> Yours,
> Russ Magee %-)
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7947a3c2-b011-4cd5-b307-5bb32fc101ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to