Sum Computed Column In Django Queryset
Given the following Contribution model: class Contribution(models.Model): start_time = models.DateTimeField() end_time = models.DateTimeField(null=True) is it possible, us
Solution 1:
Not possible at the moment, there's a ticket for F() objects inside aggregation, but nothing promising.
The only way i see is to workaround by sum in python:
sum([x[1]-x[0] for x in Contribution.objects.values_list('start_time', 'end_time')])
Post a Comment for "Sum Computed Column In Django Queryset"