mirror of
https://github.com/django/django.git
synced 2025-10-27 23:56:08 +00:00
Fixed #30159 -- Removed unneeded use of OrderedDict.
Dicts preserve order since Python 3.6.
This commit is contained in:
@@ -2,7 +2,7 @@ import functools
|
||||
import sys
|
||||
import threading
|
||||
import warnings
|
||||
from collections import Counter, OrderedDict, defaultdict
|
||||
from collections import Counter, defaultdict
|
||||
from functools import partial
|
||||
|
||||
from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured
|
||||
@@ -31,10 +31,10 @@ class Apps:
|
||||
# and whether the registry has been populated. Since it isn't possible
|
||||
# to reimport a module safely (it could reexecute initialization code)
|
||||
# all_models is never overridden or reset.
|
||||
self.all_models = defaultdict(OrderedDict)
|
||||
self.all_models = defaultdict(dict)
|
||||
|
||||
# Mapping of labels to AppConfig instances for installed apps.
|
||||
self.app_configs = OrderedDict()
|
||||
self.app_configs = {}
|
||||
|
||||
# Stack of app_configs. Used to store the current state in
|
||||
# set_available_apps and set_installed_apps.
|
||||
@@ -316,10 +316,11 @@ class Apps:
|
||||
)
|
||||
|
||||
self.stored_app_configs.append(self.app_configs)
|
||||
self.app_configs = OrderedDict(
|
||||
(label, app_config)
|
||||
self.app_configs = {
|
||||
label: app_config
|
||||
for label, app_config in self.app_configs.items()
|
||||
if app_config.name in available)
|
||||
if app_config.name in available
|
||||
}
|
||||
self.clear_cache()
|
||||
|
||||
def unset_available_apps(self):
|
||||
@@ -347,7 +348,7 @@ class Apps:
|
||||
if not self.ready:
|
||||
raise AppRegistryNotReady("App registry isn't ready yet.")
|
||||
self.stored_app_configs.append(self.app_configs)
|
||||
self.app_configs = OrderedDict()
|
||||
self.app_configs = {}
|
||||
self.apps_ready = self.models_ready = self.loading = self.ready = False
|
||||
self.clear_cache()
|
||||
self.populate(installed)
|
||||
|
||||
Reference in New Issue
Block a user