mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #26179 -- Removed null assignment check for non-nullable foreign key fields.
This commit is contained in:
@@ -717,14 +717,11 @@ class ProxyRelatedModelTest(TestCase):
|
||||
|
||||
|
||||
class TestInitWithNoneArgument(SimpleTestCase):
|
||||
def test_none_not_allowed(self):
|
||||
# TaggedItem requires a content_type, initializing with None should
|
||||
# raise a ValueError.
|
||||
msg = 'Cannot assign None: "TaggedItem.content_type" does not allow null values'
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
TaggedItem(content_object=None)
|
||||
|
||||
def test_none_allowed(self):
|
||||
# AllowsNullGFK doesn't require a content_type, so None argument should
|
||||
# also be allowed.
|
||||
AllowsNullGFK(content_object=None)
|
||||
# TaggedItem requires a content_type but initializing with None should
|
||||
# be allowed.
|
||||
TaggedItem(content_object=None)
|
||||
|
||||
Reference in New Issue
Block a user