1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Ensure bootstrapping of config on start

This commit is contained in:
jeremystretch
2021-10-26 16:45:53 -04:00
parent 561e06e7f0
commit ff5c274048
3 changed files with 24 additions and 5 deletions

View File

@ -560,6 +560,13 @@ class ConfigRevision(models.Model):
return self.data[item]
return super().__getattribute__(item)
def cache(self):
"""
Cache the configuration data.
"""
cache.set('config', self.data, None)
cache.set('config_version', self.pk, None)
@admin.display(boolean=True)
def is_active(self):
return cache.get('config_version') == self.pk