@@ -99,7 +99,7 @@ def setUpTestData(cls):
9999 pet = Cat (
100100 name = f"Cat { x } " ,
101101 weight = f"{ x } .5" ,
102- toys = Mouse (manufacturer = f"Maker { x } " ),
102+ favorite_toy = Mouse (manufacturer = f"Maker { x } " ),
103103 ),
104104 )
105105 for x in range (6 )
@@ -110,7 +110,7 @@ def setUpTestData(cls):
110110 pet = Dog (
111111 name = f"Dog { x } " ,
112112 barks = x % 2 == 0 ,
113- toys = Bone (brand = f"Brand { x } " ),
113+ favorite_toy = Bone (brand = f"Brand { x } " ),
114114 ),
115115 )
116116 for x in range (6 )
@@ -147,17 +147,17 @@ def test_boolean(self):
147147 )
148148
149149 def test_nested (self ):
150- # Cat and Dog both have field toys = PolymorphicEmbeddedModelField(...)
150+ # Cat and Dog both have favorite_toy = PolymorphicEmbeddedModelField(...)
151151 # 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.
153153 self .assertCountEqual (
154- Person .objects .filter (pet__toys__brand = "Brand 1" ),
154+ Person .objects .filter (pet__favorite_toy__brand = "Brand 1" ),
155155 [self .dog_owners [1 ]],
156156 )
157157 # 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'."
159159 with self .assertRaisesMessage (FieldDoesNotExist , msg ):
160- (Person .objects .filter (pet__toys__manufacturer = "Maker 1" ),)
160+ (Person .objects .filter (pet__favorite_toy__manufacturer = "Maker 1" ),)
161161
162162
163163class InvalidLookupTests (SimpleTestCase ):
0 commit comments