Opened 9 years ago

Last modified 8 years ago

#26517 closed Bug

Empty Querset Using Empty Queryset in ExpressionWrapper — at Initial Version

Reported by: Sven R. Kunze Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

We use the ExpressionWrapper + annotate to annotate specific boolean values to all queried instances like this (minimal working example):

editable_ones = ..... # another queryset
result = MyModel.objects.annotate(editable=ExpressionWrapper(Q(pk__in=editable_child_folders), output_field=BooleanField())

As soon as editable_ones is empty, result is also empty. Reading the docs, I guess this is not desired behavior (https://docs.djangoproject.com/en/1.9/ref/models/querysets/#annotate).

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top