Changes between Version 1 and Version 3 of Ticket #32549


Ignore:
Timestamp:
Mar 15, 2021, 4:33:51 PM (4 years ago)
Author:
jonathan-golorry
Comment:

Here is an alternate approach that adds a way to check for nested empty Q objects instead of making them impossible to create.

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  
    1313}}}
    1414
    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
     17Patch 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.
    1618
    1719This requires https://code.djangoproject.com/ticket/32548 in order to prevent a regression in logical operations between query expressions and empty Q objects.
Back to Top