Farzan
Farzan

Reputation: 198

Aggregate method in Django

I am new to Django and when I use Aggregate method, it returns something like:

{'max__age' : 35}

but I need to display just the number ("35" in this example).

Upvotes: 1

Views: 63

Answers (1)

willeM_ Van Onsem
willeM_ Van Onsem

Reputation: 477883

You use subscripting to access the value. So for example:

MyModel.objects.aggregate(…)['max__age']

Upvotes: 1

Related Questions