Small cleanup in prefetch_related code
This commit is contained in:
parent
4fea46a030
commit
f5ce1793a8
|
@ -483,7 +483,7 @@ class ForeignRelatedObjectsDescriptor(object):
|
||||||
return qs
|
return qs
|
||||||
|
|
||||||
def get_prefetch_query_set(self, instances):
|
def get_prefetch_query_set(self, instances):
|
||||||
rel_obj_attr = attrgetter(rel_field.get_attname())
|
rel_obj_attr = attrgetter(rel_field.attname)
|
||||||
instance_attr = attrgetter(attname)
|
instance_attr = attrgetter(attname)
|
||||||
instances_dict = dict((instance_attr(inst), inst) for inst in instances)
|
instances_dict = dict((instance_attr(inst), inst) for inst in instances)
|
||||||
db = self._db or router.db_for_read(self.model, instance=instances[0])
|
db = self._db or router.db_for_read(self.model, instance=instances[0])
|
||||||
|
|
Loading…
Reference in New Issue