浏览代码

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

MariKiev 8 年之前
父节点
当前提交
30d110ef43
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      docs/topics/db/aggregation.txt

+ 1 - 0
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}