Fixed #29573 -- Added links in aggregation topic guide.

This commit is contained in:
Vishvajit Pathak 2018-09-10 19:23:19 +05:30 committed by Tim Graham
parent 22e8ab0286
commit a48bc0cec9
1 changed files with 10 additions and 9 deletions

View File

@ -149,19 +149,20 @@ Generating aggregates for each item in a ``QuerySet``
===================================================== =====================================================
The second way to generate summary values is to generate an independent The second way to generate summary values is to generate an independent
summary for each object in a ``QuerySet``. For example, if you are retrieving summary for each object in a :class:`.QuerySet`. For example, if you are
a list of books, you may want to know how many authors contributed to retrieving a list of books, you may want to know how many authors contributed
each book. Each Book has a many-to-many relationship with the Author; we to each book. Each Book has a many-to-many relationship with the Author; we
want to summarize this relationship for each book in the ``QuerySet``. want to summarize this relationship for each book in the ``QuerySet``.
Per-object summaries can be generated using the ``annotate()`` clause. Per-object summaries can be generated using the
When an ``annotate()`` clause is specified, each object in the ``QuerySet`` :meth:`~.QuerySet.annotate` clause. When an ``annotate()`` clause is
will be annotated with the specified values. specified, each object in the ``QuerySet`` will be annotated with the
specified values.
The syntax for these annotations is identical to that used for the The syntax for these annotations is identical to that used for the
``aggregate()`` clause. Each argument to ``annotate()`` describes an :meth:`~.QuerySet.aggregate` clause. Each argument to ``annotate()`` describes
aggregate that is to be calculated. For example, to annotate books with an aggregate that is to be calculated. For example, to annotate books with the
the number of authors: number of authors:
.. code-block:: python .. code-block:: python