mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Fix tests
This commit is contained in:
parent
85c06372ff
commit
7aa1fabbd7
@ -251,7 +251,7 @@ class CustomField(ChangeLoggedModel):
|
||||
if self.type == CustomFieldTypeChoices.TYPE_OBJECT:
|
||||
return value.pk
|
||||
if self.type == CustomFieldTypeChoices.TYPE_MULTIOBJECT:
|
||||
return [obj.pk for obj in value]
|
||||
return [obj.pk for obj in value] or None
|
||||
return value
|
||||
|
||||
def deserialize(self, value):
|
||||
|
@ -52,6 +52,13 @@ class CustomFieldModelFormTest(TestCase):
|
||||
)
|
||||
cf_object.content_types.set([obj_type])
|
||||
|
||||
cf_multiobject = CustomField.objects.create(
|
||||
name='multiobject',
|
||||
type=CustomFieldTypeChoices.TYPE_MULTIOBJECT,
|
||||
object_type=ContentType.objects.get_for_model(Site)
|
||||
)
|
||||
cf_multiobject.content_types.set([obj_type])
|
||||
|
||||
def test_empty_values(self):
|
||||
"""
|
||||
Test that empty custom field values are stored as null
|
||||
|
Loading…
Reference in New Issue
Block a user