mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 17:08:41 -06:00
Fixes #14952: Update existing AutoSyncRecord when changing the data file of an auto-synced object
This commit is contained in:
parent
2e74952ac6
commit
de5c5aeb2a
@ -489,10 +489,10 @@ class SyncedDataMixin(models.Model):
|
|||||||
# Create/delete AutoSyncRecord as needed
|
# Create/delete AutoSyncRecord as needed
|
||||||
content_type = ContentType.objects.get_for_model(self)
|
content_type = ContentType.objects.get_for_model(self)
|
||||||
if self.auto_sync_enabled:
|
if self.auto_sync_enabled:
|
||||||
AutoSyncRecord.objects.get_or_create(
|
AutoSyncRecord.objects.update_or_create(
|
||||||
datafile=self.data_file,
|
|
||||||
object_type=content_type,
|
object_type=content_type,
|
||||||
object_id=self.pk
|
object_id=self.pk,
|
||||||
|
defaults={'datafile': self.data_file}
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
AutoSyncRecord.objects.filter(
|
AutoSyncRecord.objects.filter(
|
||||||
|
Loading…
Reference in New Issue
Block a user