diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-03-31 07:40:32 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-03-31 10:54:59 +0200 |
| commit | d7eb500338e11999962e618f0701e62af511d8e9 (patch) | |
| tree | 871f091e59902fd3b3e0aade18364cf7c09e3cbf /django/db/models/sql/query.py | |
| parent | 0a3c6fe6b2c43b0bb90cb9df3840dcb70edc22a1 (diff) | |
Removed unnecessary Query.get_loaded_field_names_cb() and Query.deferred_to_data()'s callback argument.
Diffstat (limited to 'django/db/models/sql/query.py')
| -rw-r--r-- | django/db/models/sql/query.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 586930a8cf..c07a4b342a 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -703,7 +703,7 @@ class Query(BaseExpression): self.order_by = rhs.order_by or self.order_by self.extra_order_by = rhs.extra_order_by or self.extra_order_by - def deferred_to_data(self, target, callback): + def deferred_to_data(self, target): """ Convert the self.deferred_loading data structure to an alternate data structure, describing the field that *will* be loaded. This is used to @@ -713,9 +713,6 @@ class Query(BaseExpression): the result, only those that have field restrictions in place. The "target" parameter is the instance that is populated (in place). - The "callback" is a function that is called whenever a (model, field) - pair need to be added to "target". It accepts three parameters: - "target", and the model and list of fields being added for that model. """ field_names, defer = self.deferred_loading if not field_names: @@ -770,8 +767,8 @@ class Query(BaseExpression): # "else" branch here. if model in workset: workset[model].update(values) - for model, values in workset.items(): - callback(target, model, values) + for model, fields in workset.items(): + target[model] = {f.attname for f in fields} else: for model, values in must_include.items(): if model in seen: @@ -786,8 +783,8 @@ class Query(BaseExpression): # only "must include" fields are pulled in. for model in orig_opts.get_parent_list(): seen.setdefault(model, set()) - for model, values in seen.items(): - callback(target, model, values) + for model, fields in seen.items(): + target[model] = {f.attname for f in fields} def table_alias(self, table_name, create=False, filtered_relation=None): """ @@ -2341,10 +2338,6 @@ class Query(BaseExpression): # Replace any existing "immediate load" field names. self.deferred_loading = frozenset(field_names), False - 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} - def set_annotation_mask(self, names): """Set the mask of annotations that will be returned by the SELECT.""" if names is None: |
