mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-15 00:02:17 -06:00
* #19680 fix deletion dependency order for GenericRelations * 19680 add test * 19680 fix Collector and test * 19680 put on changeloggingmixin * 19680 cleanup * 19680 cleanup * 19680 cleanup * 19680 skip changelog update for deleted objects * 19680 remove print
This commit is contained in:
@@ -162,6 +162,12 @@ def handle_deleted_object(sender, instance, **kwargs):
|
||||
getattr(obj, related_field_name).remove(instance)
|
||||
elif type(relation) is ManyToOneRel and relation.field.null is True:
|
||||
setattr(obj, related_field_name, None)
|
||||
# make sure the object hasn't been deleted - in case of
|
||||
# deletion chaining of related objects
|
||||
try:
|
||||
obj.refresh_from_db()
|
||||
except DoesNotExist:
|
||||
continue
|
||||
obj.save()
|
||||
|
||||
# Enqueue the object for event processing
|
||||
|
||||
Reference in New Issue
Block a user