@@ -99,7 +99,7 @@ def setUpTestData(cls):
99
99
pet = Cat (
100
100
name = f"Cat { x } " ,
101
101
weight = f"{ x } .5" ,
102
- toys = Mouse (manufacturer = f"Maker { x } " ),
102
+ favorite_toy = Mouse (manufacturer = f"Maker { x } " ),
103
103
),
104
104
)
105
105
for x in range (6 )
@@ -110,7 +110,7 @@ def setUpTestData(cls):
110
110
pet = Dog (
111
111
name = f"Dog { x } " ,
112
112
barks = x % 2 == 0 ,
113
- toys = Bone (brand = f"Brand { x } " ),
113
+ favorite_toy = Bone (brand = f"Brand { x } " ),
114
114
),
115
115
)
116
116
for x in range (6 )
@@ -147,17 +147,17 @@ def test_boolean(self):
147
147
)
148
148
149
149
def test_nested (self ):
150
- # Cat and Dog both have field toys = PolymorphicEmbeddedModelField(...)
150
+ # Cat and Dog both have favorite_toy = PolymorphicEmbeddedModelField(...)
151
151
# but with different models. It's possible to query the fields of the
152
- # Dog's toys because it's the first model in Person.pet.
152
+ # Dog's favorite_toy because it's the first model in Person.pet.
153
153
self .assertCountEqual (
154
- Person .objects .filter (pet__toys__brand = "Brand 1" ),
154
+ Person .objects .filter (pet__favorite_toy__brand = "Brand 1" ),
155
155
[self .dog_owners [1 ]],
156
156
)
157
157
# The fields of Cat can't be queried.
158
- msg = "The models of field 'toys ' have no field named 'manufacturer'."
158
+ msg = "The models of field 'favorite_toy ' have no field named 'manufacturer'."
159
159
with self .assertRaisesMessage (FieldDoesNotExist , msg ):
160
- (Person .objects .filter (pet__toys__manufacturer = "Maker 1" ),)
160
+ (Person .objects .filter (pet__favorite_toy__manufacturer = "Maker 1" ),)
161
161
162
162
163
163
class InvalidLookupTests (SimpleTestCase ):
0 commit comments