Skip to content

Commit

Permalink
adds delete for SyncedDataMixin when related AutoSyncRecord is availa…
Browse files Browse the repository at this point in the history
…ble #12750
  • Loading branch information
abhi1693 authored and jeremystretch committed Aug 4, 2023
1 parent 43ce453 commit 01bb09d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions netbox/netbox/models/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,19 @@ def save(self, *args, **kwargs):

return ret

def delete(self, *args, **kwargs):
from core.models import AutoSyncRecord

# Delete AutoSyncRecord
content_type = ContentType.objects.get_for_model(self)
AutoSyncRecord.objects.filter(
datafile=self.data_file,
object_type=content_type,
object_id=self.pk
).delete()

return super().delete(*args, **kwargs)

def resolve_data_file(self):
"""
Determine the designated DataFile object identified by its parent DataSource and its path. Returns None if
Expand Down

0 comments on commit 01bb09d

Please sign in to comment.