Skip to content

Commit

Permalink
Fixes #14952: Update existing AutoSyncRecord when changing the data f…
Browse files Browse the repository at this point in the history
…ile of an auto-synced object
  • Loading branch information
jeremystretch committed Feb 16, 2024
1 parent 2e74952 commit d34098d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions netbox/netbox/models/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,10 @@ def save(self, *args, **kwargs):
# Create/delete AutoSyncRecord as needed
content_type = ContentType.objects.get_for_model(self)
if self.auto_sync_enabled:
AutoSyncRecord.objects.get_or_create(
datafile=self.data_file,
AutoSyncRecord.objects.update_or_create(
object_type=content_type,
object_id=self.pk
object_id=self.pk,
defaults={'datafile': self.data_file}
)
else:
AutoSyncRecord.objects.filter(
Expand Down

0 comments on commit d34098d

Please sign in to comment.