Skip to content

Conversation

charettes
Copy link
Member

Trac ticket number

ticket-36432

Branch description

Regression in 626d77e.

Refs ticket-36116.

Thanks @cpoppema for the excellent report.

Comment on lines +173 to +176
Copy link
Member Author

@charettes charettes Jun 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We assumed the foreign_related_fields would always be resolved as they are local to the foreign target but when a target subclass is provided (target being Employee and target subclass being SelfDirectedEmployee) it's not necessarily the case (as related fields might be inherited and thus not local) so we must ensure they are resolved so the parent tables are JOIN'ed.

In a world where we truly support composite fields and would have the equivalent of F(*fields) we could simply pass it to TupleIn so it gets resolved explicitly. e.g.

TupleIn(
    F(*(field.name for field in self.field.foreign_related_fields)),
    list(instances_dict)
)

@charettes charettes marked this pull request as ready for review June 4, 2025 02:47
…lass queryset.

Regression in 626d77e.

Refs #36116.

Thanks Cornelis Poppema for the excellent report.
Copy link
Contributor

@sarahboyce sarahboyce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for picking this up and resolving so quickly @charettes
This looks good to me ⭐

@sarahboyce sarahboyce merged commit 08187c9 into django:main Jun 4, 2025
18 of 32 checks passed
@charettes charettes deleted the ticket-36432 branch June 4, 2025 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants