Refs #24020 -- Removed redundant Query.get_loaded_field_names().
get_loaded_field_names() is no longer called in multiple places
(see 0c7633178f
) and it's redundant
with SQLCompiler.deferred_to_columns().
This commit is contained in:
parent
0db0a25d84
commit
0a3c6fe6b2
|
@ -1006,7 +1006,7 @@ class SQLCompiler:
|
|||
if not opts:
|
||||
opts = self.query.get_meta()
|
||||
root_alias = self.query.get_initial_alias()
|
||||
only_load = self.query.get_loaded_field_names()
|
||||
only_load = self.deferred_to_columns()
|
||||
|
||||
# Setup for the case when only particular related fields should be
|
||||
# included in the related selection.
|
||||
|
|
|
@ -2341,25 +2341,6 @@ class Query(BaseExpression):
|
|||
# Replace any existing "immediate load" field names.
|
||||
self.deferred_loading = frozenset(field_names), False
|
||||
|
||||
def get_loaded_field_names(self):
|
||||
"""
|
||||
If any fields are marked to be deferred, return a dictionary mapping
|
||||
models to a set of names in those fields that will be loaded. If a
|
||||
model is not in the returned dictionary, none of its fields are
|
||||
deferred.
|
||||
|
||||
If no fields are marked for deferral, return an empty dictionary.
|
||||
"""
|
||||
# We cache this because we call this function multiple times
|
||||
# (compiler.fill_related_selections, query.iterator)
|
||||
try:
|
||||
return self._loaded_field_names_cache
|
||||
except AttributeError:
|
||||
collection = {}
|
||||
self.deferred_to_data(collection, self.get_loaded_field_names_cb)
|
||||
self._loaded_field_names_cache = collection
|
||||
return collection
|
||||
|
||||
def get_loaded_field_names_cb(self, target, model, fields):
|
||||
"""Callback used by get_deferred_field_names()."""
|
||||
target[model] = {f.attname for f in fields}
|
||||
|
|
Loading…
Reference in New Issue