diff options
| author | MariKiev <iam.marik@gmail.com> | 2016-05-14 17:16:55 +0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-05-25 09:57:55 -0400 |
| commit | 4f5013969261cb45fc3cfd5e983b97439b7966c5 (patch) | |
| tree | 6ee28fba0ad80606bf91a85ca174f9bf9da344c6 | |
| parent | 141f6e5588afefd16a560ef90dd44034235844d9 (diff) | |
[1.8.x] Added imports to docs/topics/db/aggregation.txt example.
Backport of 30d110ef43d8a3c50ea8ec4e4fe49bd2bb859530 from master
| -rw-r--r-- | docs/topics/db/aggregation.txt | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/docs/topics/db/aggregation.txt b/docs/topics/db/aggregation.txt index cdf79503d6..a3c75db4dd 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} |
