浏览代码

Fixed #22710 -- Documented aggregation behavior for empty QuerySets.

Thanks matklad for the report.
Guillaume Pannatier 11 年之前
父节点
当前提交
7c6e96ec1f
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      docs/ref/models/querysets.txt

+ 6 - 0
docs/ref/models/querysets.txt

@@ -2631,6 +2631,12 @@ aggregate functions, see
     aggregation on date/time fields in SQLite will raise
     ``NotImplementedError``.
 
+.. admonition:: Note
+
+    Aggregation functions will return ``None`` when used with an empty
+    ``QuerySet``. For example, the ``Count`` aggregation function will return
+    ``None`` instead of ``0`` if the ``QuerySet`` contains no entries.
+
 Avg
 ~~~