Changes between Version 1 and Version 2 of Ticket #32554
- Timestamp:
- Mar 19, 2021, 3:13:59 PM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #32554 – Description
v1 v2 1 `Q.empty()` checks for nested empty Q objects such as `Q(Q())`. See #32549 for rationale. 2 1 3 `Q.FALSE` and `Q.TRUE` are classattribute aliases for `Q(pk__in=[])` and `~Q(pk__in=[])`. 2 4 3 5 `Q.any()` and `Q.all()` mimic python's builtin `any` and `all`, defaulting to `Q.FALSE` and `Q.TRUE` for empty iterators (or iterators containing only empty Q objects). 4 6 5 Patch: https://github.com/django/django/pull/141 317 Patch: https://github.com/django/django/pull/14159 6 8 7 9 See this forum thread discussing why these are an improvement over many ad-hoc implementations people are using: https://forum.djangoproject.com/t/improving-q-objects-with-true-false-and-none/851 8 9 My patch relies on https://code.djangoproject.com/ticket/32548 and https://code.djangoproject.com/ticket/32549. I kept those as separate tickets because they each had side effects that warranted their own discussion.