This commit is contained in:
jeremystretch 2023-04-14 17:05:51 -04:00
parent 80904979a2
commit 9885184776
2 changed files with 3 additions and 1 deletions

View File

@ -17,5 +17,5 @@ def auto_sync(instance, **kwargs):
"""
from .models import AutoSyncRecord
for autosync in AutoSyncRecord.objects.filter(datafile__source=instance):
for autosync in AutoSyncRecord.objects.filter(datafile__source=instance).prefetch_related('object'):
autosync.object.sync(save=True)

View File

@ -453,6 +453,8 @@ class SyncedDataMixin(models.Model):
"""
Synchronize the object from it's assigned DataFile (if any). This wraps sync_data() and updates
the synced_data timestamp.
:param save: If true, save() will be called after data has been synchronized
"""
self.sync_data()
self.data_synced = timezone.now()