mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #26916 -- Fixed prefetch_related when using a cached_property as to_attr.
Thanks Trac alias karyon for the report and Tim for the review.
This commit is contained in:
@@ -6,6 +6,7 @@ from django.contrib.contenttypes.fields import (
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db import models
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.functional import cached_property
|
||||
|
||||
|
||||
# Basic tests
|
||||
@@ -219,6 +220,10 @@ class Person(models.Model):
|
||||
def all_houses(self):
|
||||
return list(self.houses.all())
|
||||
|
||||
@cached_property
|
||||
def cached_all_houses(self):
|
||||
return self.all_houses
|
||||
|
||||
class Meta:
|
||||
ordering = ['id']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user