Kaydet (Commit) 30d110ef authored tarafından MariKiev's avatar MariKiev Kaydeden (comit) Tim Graham

Added imports to docs/topics/db/aggregation.txt example.

üst a247c1d7
......@@ -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}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment