Documented a current limitation of multiple table annotation; refs #10060.

This commit is contained in:
Benjamin Bach 2014-12-01 00:02:43 +01:00 committed by Tim Graham
parent 16f26defa7
commit 4b23a6c7a9
1 changed files with 11 additions and 0 deletions

View File

@ -184,6 +184,17 @@ of the ``annotate()`` clause is a ``QuerySet``; this ``QuerySet`` can be
modified using any other ``QuerySet`` operation, including ``filter()``,
``order_by()``, or even additional calls to ``annotate()``.
.. admonition:: If in doubt, inspect the SQL query!
In order to understand what happens in your query, consider inspecting the
``query`` property of your ``QuerySet``.
For instance, combining multiple aggregations with ``annotate()`` will
yield the wrong results, as `multiple tables are the cross joined`_,
resulting in duplicate row aggregations.
.. _multiple tables are the cross joined: https://code.djangoproject.com/ticket/10060
Joins and aggregates
====================