Is it possible to calculate the cumulative (running) sum using django\'s orm? Consider the following model:
class AModel(models.Model): a_number = models
For reference, starting with Django 2.0 it is possible to use the Window function to achieve this result:
Window
AModel.objects.annotate(cumsum=Window(Sum('a_number'), order_by=F('id').asc()))\ .values('id', 'cumsum').order_by('id', 'cumsum')