mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #26179 -- Removed null assignment check for non-nullable foreign key fields.
This commit is contained in:
parent
353aecbf8c
commit
04e13c8913
5 changed files with 32 additions and 42 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue