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:48 -0400 |
| commit | 8f96859e1e5a277f18a76144d17017107280ac70 (patch) | |
| tree | 2eadab834de3e3a9ee6658a2c401ef2b4eb63862 /docs | |
| parent | e76c6a751de91a3305ed8c9ffcff84243ce08c61 (diff) | |
[1.9.x] Added imports to docs/topics/db/aggregation.txt example.
Backport of 30d110ef43d8a3c50ea8ec4e4fe49bd2bb859530 from master
Diffstat (limited to 'docs')
| -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 ddae76a442..ec11fcf4ee 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} |
