File tree 1 file changed +9
-6
lines changed
1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 1
1
from django .contrib import messages
2
+ from django .core .cache import cache
2
3
from django .shortcuts import get_object_or_404 , redirect
3
4
4
5
from extras .models import ConfigRevision
@@ -153,9 +154,11 @@ class ConfigView(generic.ObjectView):
153
154
queryset = ConfigRevision .objects .all ()
154
155
155
156
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