File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 11from django .contrib import messages
2+ from django .core .cache import cache
23from django .shortcuts import get_object_or_404 , redirect
34
45from 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+ )
You can’t perform that action at this time.
0 commit comments