Skip to content

Commit bf4a0ca

Browse files
authored
Merge pull request #125 from pitan/fix/customfield_validation
Fix custom field object type check
2 parents 94072e0 + 2f0a0df commit bf4a0ca

File tree

1 file changed

+1
-1
lines changed
  • src/netbox_initializers/initializers

1 file changed

+1
-1
lines changed

src/netbox_initializers/initializers/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def set_custom_fields_values(self, entity, custom_field_data):
5252
missing_cfs.append(key)
5353
else:
5454
ct = ObjectType.objects.get_for_model(entity)
55-
if ct not in cf.object_types.all():
55+
if not cf.object_types.filter(pk=ct.pk).exists():
5656
print(
5757
f"⚠️ Custom field {key} is not enabled for {entity}'s model!"
5858
"Please check the 'on_objects' for that custom field in custom_fields.yml"

0 commit comments

Comments
 (0)