Changes between Version 1 and Version 3 of Ticket #32549
- Timestamp:
- Mar 15, 2021, 4:33:51 PM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #32549
- Property Summary Make `Q(Q(), ...)` equivalent to `Q(...)` → Add `Q.empty()` to check for nested empty Q objects like `Q(Q())`
-
Ticket #32549 – Description
v1 v3 13 13 }}} 14 14 15 Patch https://github.com/django/django/pull/14127 removes empty Q objects from `args` during Q object initialization. 15 ~~Patch https://github.com/django/django/pull/14127 removes empty Q objects from `args` during Q object initialization.~~ 16 17 Patch https://github.com/django/django/pull/14130 adds `.empty()` for detecting nested empty Q objects and uses that instead of boolean evaluation for shortcutting logical operations between empty Q objects. So `Q(x=1) | Q(Q())` will now shortcut to `Q(x=1)` the same way `Q(x=1) | Q()` does. No simplifying is done during Q object initialization. 16 18 17 19 This requires https://code.djangoproject.com/ticket/32548 in order to prevent a regression in logical operations between query expressions and empty Q objects.