Opened 2 years ago
Closed 2 years ago
#33959 closed Bug (duplicate)
Missing import in "Expressions can reference transforms" section
Reported by: | Eido Askayo | Owned by: | Iván Triviño |
---|---|---|---|
Component: | Documentation | Version: | 4.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In section Expressions can reference transforms, the following code is shown:
>>> Entry.objects.values('pub_date__year').annotate( ... top_rating=Subquery( ... Entry.objects.filter( ... pub_date__year=OuterRef('pub_date__year') ... ).order_by('-rating').values('rating')[:1] ... ), ... total_comments=Sum('number_of_comments'))
There are missing imports for Subquery
, OuterRef
and Sum
functions:
>>> from django.db.models import Subquery, OuterRef, Sum
Change History (2)
comment:1 by , 2 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 2 years ago
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Duplicate of #33958.