Skip to content

Commit

Permalink
#11558: Set data_synced time under model's clean()
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Mar 20, 2023
1 parent 2b3b951 commit ecb8f15
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 0 additions & 2 deletions netbox/extras/models/configs.py
Expand Up @@ -141,7 +141,6 @@ def sync_data(self):
Synchronize context data from the designated DataFile (if any).
"""
self.data = self.data_file.get_data()
self.data_synced = timezone.now()


class ConfigContextModel(models.Model):
Expand Down Expand Up @@ -227,7 +226,6 @@ def sync_data(self):
Synchronize template content from the designated DataFile (if any).
"""
self.template_code = self.data_file.data_as_string
self.data_synced = timezone.now()

def render(self, context=None):
"""
Expand Down
1 change: 0 additions & 1 deletion netbox/extras/models/models.py
Expand Up @@ -354,7 +354,6 @@ def sync_data(self):
Synchronize template content from the designated DataFile (if any).
"""
self.template_code = self.data_file.data_as_string
self.data_synced = timezone.now()

def render(self, queryset):
"""
Expand Down
2 changes: 2 additions & 0 deletions netbox/netbox/models/features.py
Expand Up @@ -6,6 +6,7 @@
from django.db import models
from django.db.models.signals import class_prepared
from django.dispatch import receiver
from django.utils import timezone
from django.utils.translation import gettext as _

from taggit.managers import TaggableManager
Expand Down Expand Up @@ -377,6 +378,7 @@ def clean(self):
self.data_source = self.data_file.source
self.data_path = self.data_file.path
self.sync_data()
self.data_synced = timezone.now()
else:
self.data_source = None
self.data_path = ''
Expand Down

0 comments on commit ecb8f15

Please sign in to comment.