mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Allowed custom querysets when prefetching single valued relations
The original patch for custom prefetches didn't allow usage of custom queryset for single valued relations (along ForeignKey or OneToOneKey). Allowing these enables calling performance oriented queryset methods like select_related or defer/only. Thanks @akaariai and @timgraham for the reviews. Refs #17001.
This commit is contained in:
committed by
Anssi Kääriäinen
parent
c8d61fa109
commit
7bbb6958dc
@@ -170,8 +170,10 @@ class Comment(models.Model):
|
||||
## Models for lookup ordering tests
|
||||
|
||||
class House(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
address = models.CharField(max_length=255)
|
||||
owner = models.ForeignKey('Person', null=True)
|
||||
main_room = models.OneToOneField('Room', related_name='main_room_of', null=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ['id']
|
||||
|
||||
Reference in New Issue
Block a user