#33959: Missing import in "Expressions can reference transforms" section
-----------------------------------------+------------------------
Reporter: Eido Askayo | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 4.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
In section [https://docs.djangoproject.com/en/4.0/topics/db/queries
/#expressions-can-reference-transforms 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
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33959>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070182e36743f5-e3ccc6a8-9049-47bb-b3c3-e094c8caa39f-000000%40eu-central-1.amazonses.com.