I just upgraded from Django 1.6 to 1.8 due to numerous reasons. I noticed some changes in the displayed data on my application. Maybe someone can help me find the issue, please.
This is my code:
users = __apply_filters(User.objects.all(), request)
users = users.extra({
'month': 'month(created)',
'year': 'year(created)'
}).values('year', 'month').annotate(dcount=Count('created', distinct=True))
In the __apply_filters function I filter the data according to some filters.
When running the 1.6 project, I get this result:
[{'month': 11L, 'dcount': 4, 'year': 2015L}]
When running the 1.8 project, I get this result (with the same input data):
[{'month': 11L, 'dcount': 1, 'year': 2015L}, {'month': 11L, 'dcount': 1, 'year': 2015L}, {'month': 11L, 'dcount': 1, 'year': 2015L}, {'month': 11L, 'dcount': 1, 'year': 2015L}]
Obviously, this is displaying wrong data.
I would mention that my DataBase is MySQL. I need this kind of aggregation because I have date filtering and various charts displaying a timeline.
Has anyone encountered such a problem?
Thank you!