Skip to content

Commit 0613e8e

Browse files
committed
Fixes #14613: Fix display of current configuration parameters
1 parent 113c60a commit 0613e8e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

netbox/core/views.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django.contrib import messages
2+
from django.core.cache import cache
23
from django.shortcuts import get_object_or_404, redirect
34

45
from extras.models import ConfigRevision
@@ -153,9 +154,11 @@ class ConfigView(generic.ObjectView):
153154
queryset = ConfigRevision.objects.all()
154155

155156
def get_object(self, **kwargs):
156-
if config := self.queryset.first():
157-
return config
158-
# Instantiate a dummy default config if none has been created yet
159-
return ConfigRevision(
160-
data=get_config().defaults
161-
)
157+
revision_id = cache.get('config_version')
158+
try:
159+
return ConfigRevision.objects.get(pk=revision_id)
160+
except ConfigRevision.DoesNotExist:
161+
# Fall back to using the active config data if no record is found
162+
return ConfigRevision(
163+
data=get_config()
164+
)

0 commit comments

Comments
 (0)