Calculating average age in Django
问题 I need to find out average age of items (groupped by various criteria, but it does not seem to be the issue). However I fail to find how to effectively create aggregation over DateTimeField using Django (on top of MySQL). Pure Item.objects.all.aggregate(Avg('created')) seems to produce absolutely bogus values (eg. 20081988007238.133) and using Item.objects.all.extra(...) I have not found a way how to aggregate. Of course I can manually create SQL query (something like SELECT AVG(UNIX