mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
17406 allow deletion of plugin custom field if plugin removed
This commit is contained in:
parent
48ca5d4d7e
commit
f5d6f5d997
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user