mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Renamed descriptor classes for related objects.
The old names were downright confusing. Some seemed to mean the opposite
of what the class actually did.
The new names follow a consistent nomenclature:
(Forward|Reverse)(ManyToOne|OneToOne|ManyToMany)Descriptor.
I mentioned combinations that do not exist in the docstring in order to
help people who would search for them in the code base.
This commit is contained in:
@@ -595,7 +595,7 @@ class CustomPrefetchTests(TestCase):
|
||||
self.assertEqual(lst2[0].houses_lst[0].rooms_lst[0].main_room_of, self.house1)
|
||||
self.assertEqual(len(lst2[1].houses_lst), 0)
|
||||
|
||||
# Test ReverseSingleRelatedObjectDescriptor.
|
||||
# Test ForwardManyToOneDescriptor.
|
||||
houses = House.objects.select_related('owner')
|
||||
with self.assertNumQueries(6):
|
||||
rooms = Room.objects.all().prefetch_related('house')
|
||||
@@ -624,7 +624,7 @@ class CustomPrefetchTests(TestCase):
|
||||
with self.assertNumQueries(3):
|
||||
getattr(rooms.first().house, 'address')
|
||||
|
||||
# Test SingleRelatedObjectDescriptor.
|
||||
# Test ReverseOneToOneDescriptor.
|
||||
houses = House.objects.select_related('owner')
|
||||
with self.assertNumQueries(6):
|
||||
rooms = Room.objects.all().prefetch_related('main_room_of')
|
||||
|
||||
Reference in New Issue
Block a user