1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #33463 -- Fixed QuerySet.bulk_update() with F() expressions.

This commit is contained in:
Jörg Breitbart
2022-01-27 14:42:59 +01:00
committed by Mariusz Felisiak
parent e972620ada
commit 0af9a5fc7d
2 changed files with 12 additions and 2 deletions

View File

@@ -211,6 +211,16 @@ class BulkUpdateTests(TestCase):
Number.objects.bulk_update(numbers, ['num'])
self.assertCountEqual(Number.objects.filter(num=1), numbers)
def test_f_expression(self):
notes = [
Note.objects.create(note='test_note', misc='test_misc')
for _ in range(10)
]
for note in notes:
note.misc = F('note')
Note.objects.bulk_update(notes, ['misc'])
self.assertCountEqual(Note.objects.filter(misc='test_note'), notes)
def test_booleanfield(self):
individuals = [Individual.objects.create(alive=False) for _ in range(10)]
for individual in individuals: