remove_stale_data() should validate model class

This commit is contained in:
Jeremy Stretch 2025-03-24 12:46:24 -04:00
parent a6384e6c9c
commit 60a4e1fd81

View File

@ -304,9 +304,10 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
no longer assigned to a model, or because it has been deleted). no longer assigned to a model, or because it has been deleted).
""" """
for ct in content_types: for ct in content_types:
ct.model_class().objects.update( if model := ct.model_class():
custom_field_data=F('custom_field_data') - self.name model.objects.update(
) custom_field_data=F('custom_field_data') - self.name
)
def rename_object_data(self, old_name, new_name): def rename_object_data(self, old_name, new_name):
""" """