mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[4.1.x] Corrected example of redundant all() in docs.
Backport of 6df9398cce from main
This commit is contained in:
committed by
Mariusz Felisiak
parent
e0f14d8389
commit
148d60de74
@@ -111,7 +111,7 @@ belong to this ``QuerySet``. This is done by appending an ``aggregate()``
|
|||||||
clause onto the ``QuerySet``::
|
clause onto the ``QuerySet``::
|
||||||
|
|
||||||
>>> from django.db.models import Avg
|
>>> from django.db.models import Avg
|
||||||
>>> Book.objects.aggregate(Avg('price'))
|
>>> Book.objects.all().aggregate(Avg('price'))
|
||||||
{'price__avg': 34.35}
|
{'price__avg': 34.35}
|
||||||
|
|
||||||
The ``all()`` is redundant in this example, so this could be simplified to::
|
The ``all()`` is redundant in this example, so this could be simplified to::
|
||||||
|
|||||||
Reference in New Issue
Block a user