views:

15

answers:

0

I have a list of db columns that are in a particular order. Those columns are passed to a queryset and will be made into an aggregate:

for field in columns.as_list():
    if field in AGG_FIELDS:
        args.append(Sum(field))

overall_totals = MyModel.objects.filter(user=request.user).aggregate(*args)

This works fine, except that the aggregate function only returns a dict (as far as I can tell), which means I can't iterate through it without the order being all scrambled. Is there any way to get those values back in list form so the order is preserved?