diff options
| author | Colleen Dunlap <colleendunlap@Colleens-Air.lan> | 2025-05-15 15:41:59 -0400 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-05-19 10:36:08 +0200 |
| commit | 787f3130f751283140fe2be8188eb5299552232d (patch) | |
| tree | e17b9bff52622d3872e00e7193eaaa16bc25e679 /django | |
| parent | 6228a35095d06fecf55bc1a3308ab4d46cc2d57b (diff) | |
[5.2.x] Fixed #36388 -- Made QuerySet.union() return self when called with no arguments.
Regression in 9cb8baa0c4fa2c10789c5c8b65f4465932d4d172.
Thank you to Antoine Humeau for the report and Simon Charette for the review.
Backport of 802baf5da5b8d8b44990a8214a43b951e7ab8b39 from main.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/query.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py index b7d6aa28de..bb5462037c 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -1554,6 +1554,8 @@ class QuerySet(AltersData): if len(qs) == 1: return qs[0] return qs[0]._combinator_query("union", *qs[1:], all=all) + elif not other_qs: + return self return self._combinator_query("union", *other_qs, all=all) def intersection(self, *other_qs): |
