Jelajahi Sumber

15192 fix config revision if no revisions

Arthur 2 tahun lalu
induk
melakukan
9b9afdcf79
2 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 1 1
      netbox/core/models/config.py
  2. 1 1
      netbox/core/views.py

+ 1 - 1
netbox/core/models/config.py

@@ -44,7 +44,7 @@ class ConfigRevision(models.Model):
         return gettext('Config revision #{id}').format(id=self.pk)
 
     def __getattr__(self, item):
-        if item in self.data:
+        if self.data and item in self.data:
             return self.data[item]
         return super().__getattribute__(item)
 

+ 1 - 1
netbox/core/views.py

@@ -166,7 +166,7 @@ class ConfigView(generic.ObjectView):
         except ConfigRevision.DoesNotExist:
             # Fall back to using the active config data if no record is found
             return ConfigRevision(
-                data=get_config()
+                data=get_config().defaults
             )