1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #36282 -- Used prefetched values in ForwardManyToOneDescriptor from indirect ancestors.

When looking for cached values in ManyRelatedManager and
ForwardManyToOneDescriptor walk up the whole chain of ancestors
(as long as they are cached) to find the prefetched relation.
This commit is contained in:
Take Weiland
2025-03-30 11:53:32 +02:00
committed by Sarah Boyce
parent 5488530a27
commit e709301000
3 changed files with 225 additions and 22 deletions

View File

@@ -28,6 +28,10 @@ class AuthorWithAge(Author):
age = models.IntegerField()
class AuthorWithAgeChild(AuthorWithAge):
pass
class FavoriteAuthors(models.Model):
author = models.ForeignKey(
Author, models.CASCADE, to_field="name", related_name="i_like"