mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #28860 -- Removed unnecessary len() calls.
This commit is contained in:
parent
3d94ee8500
commit
d2afa5eb23
33 changed files with 56 additions and 55 deletions
|
@ -1433,7 +1433,7 @@ def prefetch_related_objects(model_instances, *related_lookups):
|
|||
Populate prefetched object caches for a list of model instances based on
|
||||
the lookups/Prefetch instances given.
|
||||
"""
|
||||
if len(model_instances) == 0:
|
||||
if not model_instances:
|
||||
return # nothing to do
|
||||
|
||||
# We need to be able to dynamically add to the list of prefetch_related
|
||||
|
@ -1461,7 +1461,7 @@ def prefetch_related_objects(model_instances, *related_lookups):
|
|||
through_attrs = lookup.prefetch_through.split(LOOKUP_SEP)
|
||||
for level, through_attr in enumerate(through_attrs):
|
||||
# Prepare main instances
|
||||
if len(obj_list) == 0:
|
||||
if not obj_list:
|
||||
break
|
||||
|
||||
prefetch_to = lookup.get_current_prefetch_to(level)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue