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

Misc cleanup

This commit is contained in:
Jeremy Stretch
2024-03-06 16:08:37 -05:00
parent 0c22e38006
commit e5ee8523ef

View File

@ -494,17 +494,17 @@ class SyncedDataMixin(models.Model):
ret = super().save(*args, **kwargs)
# Create/delete AutoSyncRecord as needed
content_type = ObjectType.objects.get_for_model(self)
object_type = ObjectType.objects.get_for_model(self)
if self.auto_sync_enabled:
AutoSyncRecord.objects.update_or_create(
object_type=content_type,
object_type=object_type,
object_id=self.pk,
defaults={'datafile': self.data_file}
)
else:
AutoSyncRecord.objects.filter(
datafile=self.data_file,
object_type=content_type,
object_type=object_type,
object_id=self.pk
).delete()
@ -514,10 +514,10 @@ class SyncedDataMixin(models.Model):
from core.models import AutoSyncRecord
# Delete AutoSyncRecord
content_type = ObjectType.objects.get_for_model(self)
object_type = ObjectType.objects.get_for_model(self)
AutoSyncRecord.objects.filter(
datafile=self.data_file,
object_type=content_type,
object_type=object_type,
object_id=self.pk
).delete()