#32398: Excluding on annotations doesn't apply null handling.
-------------------------------------+-------------------------------------
Reporter: Gordon Wrigley | Owner: Jordan
| Bae
Type: Bug | Status: assigned
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Gerben Morsink):
I think I have found another case that fails and is related to handling
nullable columns:
{{{
value = ['1', None]
status_model =
StatusModel.objects.filter(field=OuterRef('pk')).order_by('-timestamp')
qs =
RelatedModel.annotate(current_status_db=Subquery(status_model.values('status')[:1])).filter(current_status_db__in=value)
}}}
qs always returns an empty queryset, while if the filter equals
{{{.filter(current_status_db=None)}}} it works correctly.
--
Ticket URL: <https://code.djangoproject.com/ticket/32398#comment:14>
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/065.8b66024b72a3a879b4a78cba74ab82be%40djangoproject.com.