mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 02:48:38 -06:00
remove_stale_data() should validate model class
This commit is contained in:
parent
a6384e6c9c
commit
60a4e1fd81
@ -304,9 +304,10 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
|
||||
no longer assigned to a model, or because it has been deleted).
|
||||
"""
|
||||
for ct in content_types:
|
||||
ct.model_class().objects.update(
|
||||
custom_field_data=F('custom_field_data') - self.name
|
||||
)
|
||||
if model := ct.model_class():
|
||||
model.objects.update(
|
||||
custom_field_data=F('custom_field_data') - self.name
|
||||
)
|
||||
|
||||
def rename_object_data(self, old_name, new_name):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user