mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 03:56:53 -06:00
adds delete for SyncedDataMixin when related AutoSyncRecord is available #12750
This commit is contained in:
parent
43ce453938
commit
01bb09db67
@ -442,6 +442,19 @@ class SyncedDataMixin(models.Model):
|
|||||||
|
|
||||||
return ret
|
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):
|
def resolve_data_file(self):
|
||||||
"""
|
"""
|
||||||
Determine the designated DataFile object identified by its parent DataSource and its path. Returns None if
|
Determine the designated DataFile object identified by its parent DataSource and its path. Returns None if
|
||||||
|
Loading…
Reference in New Issue
Block a user