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

Introduce is_taggable utility function for identifying taggable models

This commit is contained in:
Jeremy Stretch
2019-12-11 15:26:47 -05:00
parent 8b189abd58
commit ce4a5a38a3
4 changed files with 22 additions and 4 deletions

View File

@ -9,6 +9,7 @@ from django.db.models.signals import pre_delete, post_save
from django.utils import timezone
from django_prometheus.models import model_deletes, model_inserts, model_updates
from extras.utils import is_taggable
from utilities.querysets import DummyQuerySet
from .choices import ObjectChangeActionChoices
from .models import ObjectChange
@ -41,7 +42,7 @@ def handle_deleted_object(sender, instance, **kwargs):
copy = deepcopy(instance)
# Preserve tags
if hasattr(instance, 'tags'):
if is_taggable(instance):
copy.tags = DummyQuerySet(instance.tags.all())
# Queue the copy of the object for processing once the request completes