@@ -62,10 +62,10 @@ class QueryingTests(TestCase):
6262 @classmethod
6363 def setUpTestData (cls ):
6464 cls .egypt = Exhibit .objects .create (
65- exhibit_name = "Ancient Egypt" ,
65+ name = "Ancient Egypt" ,
6666 sections = [
6767 Section (
68- section_number = 1 ,
68+ number = 1 ,
6969 artifacts = [
7070 Artifact (
7171 name = "Ptolemaic Crown" ,
@@ -78,10 +78,10 @@ def setUpTestData(cls):
7878 ],
7979 )
8080 cls .wonders = Exhibit .objects .create (
81- exhibit_name = "Wonders of the Ancient World" ,
81+ name = "Wonders of the Ancient World" ,
8282 sections = [
8383 Section (
84- section_number = 1 ,
84+ number = 1 ,
8585 artifacts = [
8686 Artifact (
8787 name = "Statue of Zeus" ,
@@ -93,7 +93,7 @@ def setUpTestData(cls):
9393 ],
9494 ),
9595 Section (
96- section_number = 2 ,
96+ number = 2 ,
9797 artifacts = [
9898 Artifact (
9999 name = "Lighthouse of Alexandria" ,
@@ -104,10 +104,10 @@ def setUpTestData(cls):
104104 ],
105105 )
106106 cls .new_descoveries = Exhibit .objects .create (
107- exhibit_name = "New Discoveries" ,
107+ name = "New Discoveries" ,
108108 sections = [
109109 Section (
110- section_number = 2 ,
110+ number = 2 ,
111111 artifacts = [
112112 Artifact (
113113 name = "Lighthouse of Alexandria" ,
@@ -118,9 +118,9 @@ def setUpTestData(cls):
118118 ],
119119 )
120120 cls .lost_empires = Exhibit .objects .create (
121- exhibit_name = "Lost Empires" ,
121+ name = "Lost Empires" ,
122122 main_section = Section (
123- section_number = 3 ,
123+ number = 3 ,
124124 artifacts = [
125125 Artifact (
126126 name = "Bronze Statue" ,
@@ -149,12 +149,12 @@ def setUpTestData(cls):
149149
150150 def test_exact (self ):
151151 self .assertCountEqual (
152- Exhibit .objects .filter (sections__section_number = 1 ), [self .egypt , self .wonders ]
152+ Exhibit .objects .filter (sections__number = 1 ), [self .egypt , self .wonders ]
153153 )
154154
155155 def test_array_index (self ):
156156 self .assertCountEqual (
157- Exhibit .objects .filter (sections__0__section_number = 1 ),
157+ Exhibit .objects .filter (sections__0__number = 1 ),
158158 [self .egypt , self .wonders ],
159159 )
160160
@@ -168,7 +168,7 @@ def test_nested_array_index(self):
168168
169169 def test_array_slice (self ):
170170 self .assertSequenceEqual (
171- Exhibit .objects .filter (sections__0_1__section_number = 2 ), [self .new_descoveries ]
171+ Exhibit .objects .filter (sections__0_1__number = 2 ), [self .new_descoveries ]
172172 )
173173
174174 def test_filter_unsupported_lookups_in_json (self ):
@@ -196,16 +196,16 @@ def test_len(self):
196196 self .assertCountEqual (Exhibit .objects .filter (sections__1__artifacts__len = 1 ), [self .wonders ])
197197
198198 def test_in (self ):
199- self .assertCountEqual (Exhibit .objects .filter (sections__section_number__in = [10 ]), [])
199+ self .assertCountEqual (Exhibit .objects .filter (sections__number__in = [10 ]), [])
200200 self .assertCountEqual (
201- Exhibit .objects .filter (sections__section_number__in = [1 ]),
201+ Exhibit .objects .filter (sections__number__in = [1 ]),
202202 [self .egypt , self .wonders ],
203203 )
204204 self .assertCountEqual (
205- Exhibit .objects .filter (sections__section_number__in = [2 ]),
205+ Exhibit .objects .filter (sections__number__in = [2 ]),
206206 [self .new_descoveries , self .wonders ],
207207 )
208- self .assertCountEqual (Exhibit .objects .filter (sections__section_number__in = [3 ]), [])
208+ self .assertCountEqual (Exhibit .objects .filter (sections__number__in = [3 ]), [])
209209
210210 def test_iexact (self ):
211211 self .assertCountEqual (
@@ -215,24 +215,24 @@ def test_iexact(self):
215215
216216 def test_gt (self ):
217217 self .assertCountEqual (
218- Exhibit .objects .filter (sections__section_number__gt = 1 ),
218+ Exhibit .objects .filter (sections__number__gt = 1 ),
219219 [self .new_descoveries , self .wonders ],
220220 )
221221
222222 def test_gte (self ):
223223 self .assertCountEqual (
224- Exhibit .objects .filter (sections__section_number__gte = 1 ),
224+ Exhibit .objects .filter (sections__number__gte = 1 ),
225225 [self .egypt , self .new_descoveries , self .wonders ],
226226 )
227227
228228 def test_lt (self ):
229229 self .assertCountEqual (
230- Exhibit .objects .filter (sections__section_number__lt = 2 ), [self .egypt , self .wonders ]
230+ Exhibit .objects .filter (sections__number__lt = 2 ), [self .egypt , self .wonders ]
231231 )
232232
233233 def test_lte (self ):
234234 self .assertCountEqual (
235- Exhibit .objects .filter (sections__section_number__lte = 2 ),
235+ Exhibit .objects .filter (sections__number__lte = 2 ),
236236 [self .egypt , self .wonders , self .new_descoveries ],
237237 )
238238
@@ -255,20 +255,20 @@ def test_invalid_field(self):
255255 def test_invalid_lookup (self ):
256256 msg = "Unsupported lookup 'return' for EmbeddedModelArrayField of 'IntegerField'"
257257 with self .assertRaisesMessage (FieldDoesNotExist , msg ):
258- Exhibit .objects .filter (sections__section_number__return = 3 )
258+ Exhibit .objects .filter (sections__number__return = 3 )
259259
260260 def test_invalid_operation (self ):
261261 msg = "Unsupported lookup 'rage' for EmbeddedModelArrayField of 'IntegerField'"
262262 with self .assertRaisesMessage (FieldDoesNotExist , msg ):
263- Exhibit .objects .filter (sections__section_number__rage = [10 ])
263+ Exhibit .objects .filter (sections__number__rage = [10 ])
264264
265265 def test_missing_lookup_suggestions (self ):
266266 msg = (
267267 "Unsupported lookup 'ltee' for EmbeddedModelArrayField of 'IntegerField', "
268268 "perhaps you meant lte or lt?"
269269 )
270270 with self .assertRaisesMessage (FieldDoesNotExist , msg ):
271- Exhibit .objects .filter (sections__section_number__ltee = 3 )
271+ Exhibit .objects .filter (sections__number__ltee = 3 )
272272
273273 def test_nested_lookup (self ):
274274 msg = "Cannot perform multiple levels of array traversal in a query."
@@ -277,11 +277,11 @@ def test_nested_lookup(self):
277277
278278 def test_foreign_field_exact (self ):
279279 """Querying from a foreign key to an EmbeddedModelArrayField."""
280- qs = Tour .objects .filter (exhibit__sections__section_number = 1 )
280+ qs = Tour .objects .filter (exhibit__sections__number = 1 )
281281 self .assertCountEqual (qs , [self .egypt_tour , self .wonders_tour ])
282282
283283 def test_foreign_field_with_slice (self ):
284- qs = Tour .objects .filter (exhibit__sections__0_2__section_number__in = [1 , 2 ])
284+ qs = Tour .objects .filter (exhibit__sections__0_2__number__in = [1 , 2 ])
285285 self .assertCountEqual (qs , [self .wonders_tour , self .egypt_tour ])
286286
287287
0 commit comments