17406 allow deletion of plugin custom field if plugin removed
This commit is contained in:

committed by
Jeremy Stretch

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]
|
||||
|
Reference in New Issue
Block a user