1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #6686: Force assignment of null custom field values to objects

This commit is contained in:
jeremystretch
2021-08-16 14:38:06 -04:00
parent 5b89cdc868
commit 9b0258fef4
4 changed files with 38 additions and 11 deletions

View File

@ -42,8 +42,11 @@ class CustomFieldTest(TestCase):
cf.save()
cf.content_types.set([obj_type])
# Assign a value to the first Site
# Check that the field has a null initial value
site = Site.objects.first()
self.assertIsNone(site.custom_field_data[cf.name])
# Assign a value to the first Site
site.custom_field_data[cf.name] = data['field_value']
site.save()
@ -73,8 +76,11 @@ class CustomFieldTest(TestCase):
cf.save()
cf.content_types.set([obj_type])
# Assign a value to the first Site
# Check that the field has a null initial value
site = Site.objects.first()
self.assertIsNone(site.custom_field_data[cf.name])
# Assign a value to the first Site
site.custom_field_data[cf.name] = 'Option A'
site.save()