summaryrefslogtreecommitdiff
path: root/django/apps
diff options
context:
space:
mode:
authorNick Pope <nick.pope@flightdataservices.com>2019-02-05 11:22:08 +0000
committerTim Graham <timograham@gmail.com>2019-02-06 13:48:39 -0500
commit24b82cd201e21060fbc02117dc16d1702877a1f3 (patch)
tree7d36db9251700d0abf8fbf69399c8abc7fd9026a /django/apps
parent21bb71ef0dcb86798edb0d8b21138bcc4b947590 (diff)
Fixed #30159 -- Removed unneeded use of OrderedDict.
Dicts preserve order since Python 3.6.
Diffstat (limited to 'django/apps')
-rw-r--r--django/apps/registry.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/django/apps/registry.py b/django/apps/registry.py
index 234a830fb9..408964a146 100644
--- a/django/apps/registry.py
+++ b/django/apps/registry.py
@@ -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)