summaryrefslogtreecommitdiff
path: root/docs/ref/models
diff options
context:
space:
mode:
authorBenjamin Bach <benjaoming@gmail.com>2017-11-17 23:30:21 +0100
committerTim Graham <timograham@gmail.com>2017-11-17 17:30:21 -0500
commitbf49d9eb0b33aefc7179d3843fad0cb7df4e7790 (patch)
tree92a1f7a11996b22fda9d9545c8387294f5b73e4a /docs/ref/models
parent9d1d3b2d2fe0bef995b024368088eeabbdf73629 (diff)
Fixed #28815 -- Fixed ExtractYear imports in docs/ref/models/expressions.txt.
Diffstat (limited to 'docs/ref/models')
-rw-r--r--docs/ref/models/expressions.txt9
1 files changed, 6 insertions, 3 deletions
diff --git a/docs/ref/models/expressions.txt b/docs/ref/models/expressions.txt
index 764ec8a955..cdcd697b86 100644
--- a/docs/ref/models/expressions.txt
+++ b/docs/ref/models/expressions.txt
@@ -721,7 +721,8 @@ computation. See :ref:`window-frames` for details.
For example, to annotate each movie with the average rating for the movies by
the same studio in the same genre and release year::
- >>> from django.db.models import Avg, ExtractYear, F, Window
+ >>> from django.db.models import Avg, F, Window
+ >>> from django.db.models.functions import ExtractYear
>>> Movie.objects.annotate(
>>> avg_rating=Window(
>>> expression=Avg('rating'),
@@ -739,7 +740,8 @@ genre, and release year) by using three window functions in the same query. The
partition and ordering from the previous example is extracted into a dictionary
to reduce repetition::
- >>> from django.db.models import Avg, ExtractYear, F, Max, Min, Window
+ >>> from django.db.models import Avg, F, Max, Min, Window
+ >>> from django.db.models.functions import ExtractYear
>>> window = {
>>> 'partition': [F('studio'), F('genre')],
>>> 'order_by': ExtractYear('released').asc(),
@@ -820,7 +822,8 @@ If a movie's "peers" are described as movies released by the same studio in the
same genre in the same year, this ``RowRange`` example annotates each movie
with the average rating of a movie's two prior and two following peers::
- >>> from django.db.models import Avg, ExtractYear, F, RowRange, Window
+ >>> from django.db.models import Avg, F, RowRange, Window
+ >>> from django.db.models.functions import ExtractYear
>>> Movie.objects.annotate(
>>> avg_rating=Window(
>>> expression=Avg('rating'),