1
0
mirror of https://github.com/django/django.git synced 2025-10-27 23:56:08 +00:00

Fixed #26207 -- Replaced dynamic classes with non-data descriptors for deferred instance loading.

This commit is contained in:
Anssi Kääriäinen
2016-02-02 11:33:09 +02:00
committed by Tim Graham
parent dac075e910
commit 7f51876f99
17 changed files with 104 additions and 240 deletions

View File

@@ -165,8 +165,7 @@ class AppConfig(object):
raise LookupError(
"App '%s' doesn't have a '%s' model." % (self.label, model_name))
def get_models(self, include_auto_created=False,
include_deferred=False, include_swapped=False):
def get_models(self, include_auto_created=False, include_swapped=False):
"""
Returns an iterable of models.
@@ -182,8 +181,6 @@ class AppConfig(object):
"""
self.check_models_ready()
for model in self.models.values():
if model._deferred and not include_deferred:
continue
if model._meta.auto_created and not include_auto_created:
continue
if model._meta.swapped and not include_swapped:

View File

@@ -156,8 +156,7 @@ class Apps(object):
# This method is performance-critical at least for Django's test suite.
@lru_cache.lru_cache(maxsize=None)
def get_models(self, include_auto_created=False,
include_deferred=False, include_swapped=False):
def get_models(self, include_auto_created=False, include_swapped=False):
"""
Returns a list of all installed models.
@@ -174,8 +173,7 @@ class Apps(object):
result = []
for app_config in self.app_configs.values():
result.extend(list(app_config.get_models(
include_auto_created, include_deferred, include_swapped)))
result.extend(list(app_config.get_models(include_auto_created, include_swapped)))
return result
def get_model(self, app_label, model_name=None):