mirror of
https://github.com/django/django.git
synced 2025-11-27 13:55:26 +00:00
Fixed #32996 -- Cached PathInfos on relations.
PathInfo values are ostensibly static over the lifetime of the object for which they're requested, so the data can be memoized, quickly amortising the cost over the process' duration.
This commit is contained in:
parent
3ff7b15bb7
commit
a697424969
11 changed files with 182 additions and 29 deletions
|
|
@ -1528,8 +1528,11 @@ class Query(BaseExpression):
|
|||
path.extend(path_to_parent)
|
||||
cur_names_with_path[1].extend(path_to_parent)
|
||||
opts = path_to_parent[-1].to_opts
|
||||
if hasattr(field, 'get_path_info'):
|
||||
pathinfos = field.get_path_info(filtered_relation)
|
||||
if hasattr(field, 'path_infos'):
|
||||
if filtered_relation:
|
||||
pathinfos = field.get_path_info(filtered_relation)
|
||||
else:
|
||||
pathinfos = field.path_infos
|
||||
if not allow_many:
|
||||
for inner_pos, p in enumerate(pathinfos):
|
||||
if p.m2m:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue