فهرست منبع

17406 allow deletion of plugin custom field if plugin removed

Arthur Hanson 1 سال پیش
والد
کامیت
f5d6f5d997
1فایلهای تغییر یافته به همراه1 افزوده شده و 2 حذف شده
  1. 1 2
      netbox/extras/models/customfields.py

+ 1 - 2
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).
         no longer assigned to a model, or because it has been deleted).
         """
         """
         for ct in content_types:
         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)
                 instances = model.objects.filter(custom_field_data__has_key=self.name)
                 for instance in instances:
                 for instance in instances:
                     del instance.custom_field_data[self.name]
                     del instance.custom_field_data[self.name]