From 23df37d53a6d7010f43920cb1202bc5254449601 Mon Sep 17 00:00:00 2001 From: Lily Foote Date: Tue, 19 Sep 2023 04:25:35 +0100 Subject: [PATCH] Simplified ForeignObject.resolve_related_fields() a bit. --- django/db/models/fields/related.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index 2c0527d2b7..8564e6366b 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -714,9 +714,7 @@ class ForeignObject(RelatedField): "Related model %r cannot be resolved" % self.remote_field.model ) related_fields = [] - for index in range(len(self.from_fields)): - from_field_name = self.from_fields[index] - to_field_name = self.to_fields[index] + for from_field_name, to_field_name in zip(self.from_fields, self.to_fields): from_field = ( self if from_field_name == RECURSIVE_RELATIONSHIP_CONSTANT