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:44 -0400 |
| commit | 699e43b017b01ab2ef9f1e7a5a75c50a20956485 (patch) | |
| tree | 992741367cf38c7ae5a9a8201049819aebe0cf5c /docs | |
| parent | de5d70461f6830c618f5bc08254ecf14bb7484b3 (diff) | |
[1.10.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 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} |
