From f5d6f5d9977dce8badd98c5a266fbd0428893a1a Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Fri, 13 Sep 2024 09:31:21 -0700 Subject: [PATCH] 17406 allow deletion of plugin custom field if plugin removed --- netbox/extras/models/customfields.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/netbox/extras/models/customfields.py b/netbox/extras/models/customfields.py index 9d29b128d..889594902 100644 --- a/netbox/extras/models/customfields.py +++ b/netbox/extras/models/customfields.py @@ -294,8 +294,7 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel): no longer assigned to a model, or because it has been deleted). """ for ct in content_types: - model = ct.model_class() - if model: + if model := ct.model_class(): instances = model.objects.filter(custom_field_data__has_key=self.name) for instance in instances: del instance.custom_field_data[self.name]