Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion testapp/tests/test_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.db.models.expressions import Case, Exists, OuterRef, Subquery, Value, When
from django.test import TestCase

from ..models import Author, Comment, Post
from ..models import Author, Comment, Editor, Post

DJANGO3 = VERSION[0] >= 3

Expand All @@ -22,6 +22,18 @@ def test_with_count(self):
).filter(post_exists=True).count()


class TestBulkUpdate(TestCase):
def test_set_null(self):
author = Author.objects.create(name="author")
editor = Editor.objects.create(name="editor")

posts = [
Post.objects.create(title="foo", author=author, alt_editor=editor),
]
posts[0].alt_editor = None
Post.objects.bulk_update(posts, ['alt_editor'])


class TestExists(TestCase):
def setUp(self):
self.author = Author.objects.create(name="author")
Expand Down