Re: (Is it a bug?) TruncMonth does not work when there is "ordering" in the model Meta (Django 1.10)

2016-08-10 Thread Tim Graham
Unfortunately, I don't think mentioning the issue every place where someone might be doing an aggregation query is practical. I did recently add a link about it to the Meta.ordering docs recently [0], so hopefully that helps raise awareness. [0] https://github.com/django/django/commit/3aaf6cf0

Re: (Is it a bug?) TruncMonth does not work when there is "ordering" in the model Meta (Django 1.10)

2016-08-10 Thread Neto
Thanks! Should have a note about it on the page "database-funcions": https://docs.djangoproject.com/en/1.10/ref/models/database-functions/#trunc Em quarta-feira, 10 de agosto de 2016 17:17:31 UTC-3, Tim Graham escreveu: > > Default ordering affects aggregation queries like that: > https://docs.dj

Re: (Is it a bug?) TruncMonth does not work when there is "ordering" in the model Meta (Django 1.10)

2016-08-10 Thread Tim Graham
Default ordering affects aggregation queries like that: https://docs.djangoproject.com/en/stable/topics/db/aggregation/#interaction-with-default-ordering-or-order-by On Wednesday, August 10, 2016 at 3:44:33 PM UTC-4, Neto wrote: > > I'm trying to get number of records per month, but Django does n

(Is it a bug?) TruncMonth does not work when there is "ordering" in the model Meta (Django 1.10)

2016-08-10 Thread Neto
I'm trying to get number of records per month, but Django does not return correctly when there is "ordering" in class Meta Model. I have the Abc model, with 4 records made this month, look what happens (Django 1.10, PostgreSQL): class Abc(Base): class Meta: ordering = ['-date_p