1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Moved object serialization into a utility function

This commit is contained in:
Jeremy Stretch
2018-06-22 14:00:23 -04:00
parent 9d419de9dc
commit 6c1b5fdf3a
3 changed files with 17 additions and 11 deletions

View File

@@ -5,7 +5,6 @@ import uuid
from django.db.models.signals import post_delete, post_save
from django.utils.functional import curry, SimpleLazyObject
from utilities.models import ChangeLoggedModel
from .constants import OBJECTCHANGE_ACTION_CREATE, OBJECTCHANGE_ACTION_DELETE, OBJECTCHANGE_ACTION_UPDATE
@@ -13,7 +12,7 @@ def record_object_change(user, request_id, instance, **kwargs):
"""
Create an ObjectChange in response to an object being created or deleted.
"""
if not isinstance(instance, ChangeLoggedModel):
if not hasattr(instance, 'log_change'):
return
# Determine what action is being performed. The post_save signal sends a `created` boolean, whereas post_delete