From 30d110ef43d8a3c50ea8ec4e4fe49bd2bb859530 Mon Sep 17 00:00:00 2001 From: MariKiev Date: Sat, 14 May 2016 17:16:55 +0700 Subject: [PATCH] Added imports to docs/topics/db/aggregation.txt example. --- docs/topics/db/aggregation.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/topics/db/aggregation.txt b/docs/topics/db/aggregation.txt index 310745d869..47563338d6 100644 --- a/docs/topics/db/aggregation.txt +++ b/docs/topics/db/aggregation.txt @@ -68,6 +68,7 @@ In a hurry? Here's how to do common aggregate queries, assuming the models above {'price__max': Decimal('81.20')} # Cost per page + >>> from django.db.models import F, FloatField, Sum >>> Book.objects.all().aggregate( ... price_per_page=Sum(F('price')/F('pages'), output_field=FloatField())) {'price_per_page': 0.4470664529184653}