diff --git a/tests/modeltests/model_formsets/models.py b/tests/modeltests/model_formsets/models.py
index cac73d7..e3fce2f 100644
a
|
b
|
__test__ = {'API_TESTS': """
|
30 | 30 | |
31 | 31 | >>> data = { |
32 | 32 | ... 'form-COUNT': '3', |
| 33 | ... 'form-REQUIRED': '0', # number of forms filled before |
33 | 34 | ... 'form-0-name': 'Charles Baudelaire', |
34 | 35 | ... 'form-1-name': 'Arthur Rimbaud', |
35 | 36 | ... 'form-2-name': '', |
… |
… |
but in that case we'll use it to display them in alphabetical order by name.
|
66 | 67 | |
67 | 68 | >>> data = { |
68 | 69 | ... 'form-COUNT': '3', |
| 70 | ... 'form-REQUIRED': '2', # number of forms filled before |
69 | 71 | ... 'form-0-id': '2', |
70 | 72 | ... 'form-0-name': 'Arthur Rimbaud', |
71 | 73 | ... 'form-1-id': '1', |
… |
… |
deltetion, make sure we don't save that form.
|
107 | 109 | |
108 | 110 | >>> data = { |
109 | 111 | ... 'form-COUNT': '4', |
| 112 | ... 'form-REQUIRED': '3', # number of forms filled before |
110 | 113 | ... 'form-0-id': '2', |
111 | 114 | ... 'form-0-name': 'Arthur Rimbaud', |
112 | 115 | ... 'form-1-id': '1', |
… |
… |
admin system's edit inline functionality works.
|
148 | 151 | |
149 | 152 | >>> data = { |
150 | 153 | ... 'book_set-COUNT': '3', |
| 154 | ... 'book_set-REQUIRED': '0', # number of forms filled before |
151 | 155 | ... 'book_set-0-title': 'Les Fleurs du Mal', |
152 | 156 | ... 'book_set-1-title': '', |
153 | 157 | ... 'book_set-2-title': '', |
… |
… |
book.
|
181 | 185 | |
182 | 186 | >>> data = { |
183 | 187 | ... 'book_set-COUNT': '3', |
| 188 | ... 'book_set-REQUIRED': '1', # number of forms filled before |
184 | 189 | ... 'book_set-0-id': '1', |
185 | 190 | ... 'book_set-0-title': 'Les Fleurs du Mal', |
186 | 191 | ... 'book_set-1-title': 'Le Spleen de Paris', |
diff --git a/tests/regressiontests/forms/formsets.py b/tests/regressiontests/forms/formsets.py
index a6da2fe..6c1cb6d 100644
a
|
b
|
the COUNT field appropriately.
|
33 | 33 | |
34 | 34 | >>> data = { |
35 | 35 | ... 'choices-COUNT': '1', # the number of forms rendered |
| 36 | ... 'choices-REQUIRED': '0', # number of forms filled before |
36 | 37 | ... 'choices-0-choice': 'Calexico', |
37 | 38 | ... 'choices-0-votes': '100', |
38 | 39 | ... } |
… |
… |
any of the forms.
|
58 | 59 | |
59 | 60 | >>> data = { |
60 | 61 | ... 'choices-COUNT': '1', # the number of forms rendered |
| 62 | ... 'choices-REQUIRED': '1', # number of forms filled before |
| 63 | ... 'choices-REQUIRED': '0', # number of forms filled before |
61 | 64 | ... 'choices-0-choice': 'Calexico', |
62 | 65 | ... 'choices-0-votes': '', |
63 | 66 | ... } |
… |
… |
Let's simulate what would happen if we submitted this form.
|
94 | 97 | |
95 | 98 | >>> data = { |
96 | 99 | ... 'choices-COUNT': '2', # the number of forms rendered |
| 100 | ... 'choices-REQUIRED': '1', # number of forms filled before |
97 | 101 | ... 'choices-0-choice': 'Calexico', |
98 | 102 | ... 'choices-0-votes': '100', |
99 | 103 | ... 'choices-1-choice': '', |
… |
… |
handle that later.
|
114 | 118 | |
115 | 119 | >>> data = { |
116 | 120 | ... 'choices-COUNT': '2', # the number of forms rendered |
| 121 | ... 'choices-REQUIRED': '1', # number of forms filled before |
117 | 122 | ... 'choices-0-choice': 'Calexico', |
118 | 123 | ... 'choices-0-votes': '100', |
119 | 124 | ... 'choices-1-choice': 'The Decemberists', |
… |
… |
handle that case later.
|
133 | 138 | |
134 | 139 | >>> data = { |
135 | 140 | ... 'choices-COUNT': '2', # the number of forms rendered |
| 141 | ... 'choices-REQUIRED': '1', # number of forms filled before |
136 | 142 | ... 'choices-0-choice': '', # deleted value |
137 | 143 | ... 'choices-0-votes': '', # deleted value |
138 | 144 | ... 'choices-1-choice': '', |
… |
… |
number of forms to be completed.
|
169 | 175 | |
170 | 176 | >>> data = { |
171 | 177 | ... 'choices-COUNT': '3', # the number of forms rendered |
| 178 | ... 'choices-REQUIRED': '0', # number of forms filled before |
172 | 179 | ... 'choices-0-choice': '', |
173 | 180 | ... 'choices-0-votes': '', |
174 | 181 | ... 'choices-1-choice': '', |
… |
… |
We can just fill out one of the forms.
|
188 | 195 | |
189 | 196 | >>> data = { |
190 | 197 | ... 'choices-COUNT': '3', # the number of forms rendered |
| 198 | ... 'choices-REQUIRED': '0', # number of forms filled before |
191 | 199 | ... 'choices-0-choice': 'Calexico', |
192 | 200 | ... 'choices-0-votes': '100', |
193 | 201 | ... 'choices-1-choice': '', |
… |
… |
And once again, if we try to partially complete a form, validation will fail.
|
207 | 215 | |
208 | 216 | >>> data = { |
209 | 217 | ... 'choices-COUNT': '3', # the number of forms rendered |
| 218 | ... 'choices-REQUIRED': '0', # number of forms filled before |
210 | 219 | ... 'choices-0-choice': 'Calexico', |
211 | 220 | ... 'choices-0-votes': '100', |
212 | 221 | ... 'choices-1-choice': 'The Decemberists', |
… |
… |
get an error.
|
244 | 253 | |
245 | 254 | >>> data = { |
246 | 255 | ... 'choices-COUNT': '3', # the number of forms rendered |
| 256 | ... 'choices-REQUIRED': '1', # number of forms filled before |
247 | 257 | ... 'choices-0-choice': 'Calexico', |
248 | 258 | ... 'choices-0-votes': '100', |
249 | 259 | ... 'choices-1-choice': '', |
… |
… |
To delete something, we just need to set that form's special delete field to
|
289 | 299 | |
290 | 300 | >>> data = { |
291 | 301 | ... 'choices-COUNT': '3', # the number of forms rendered |
| 302 | ... 'choices-REQUIRED': '2', # number of forms filled before |
292 | 303 | ... 'choices-0-choice': 'Calexico', |
293 | 304 | ... 'choices-0-votes': '100', |
294 | 305 | ... 'choices-0-DELETE': '', |
… |
… |
something at the front of the list, you'd need to set it's order to 0.
|
336 | 347 | |
337 | 348 | >>> data = { |
338 | 349 | ... 'choices-COUNT': '3', # the number of forms rendered |
| 350 | ... 'choices-REQUIRED': '2', # number of forms filled before |
339 | 351 | ... 'choices-0-choice': 'Calexico', |
340 | 352 | ... 'choices-0-votes': '100', |
341 | 353 | ... 'choices-0-ORDER': '1', |
… |
… |
Let's delete Fergie, and put The Decemberists ahead of Calexico.
|
391 | 403 | |
392 | 404 | >>> data = { |
393 | 405 | ... 'choices-COUNT': '4', # the number of forms rendered |
| 406 | ... 'choices-REQUIRED': '3', # number of forms filled before |
394 | 407 | ... 'choices-0-choice': 'Calexico', |
395 | 408 | ... 'choices-0-votes': '100', |
396 | 409 | ... 'choices-0-ORDER': '1', |
… |
… |
We start out with a some duplicate data.
|
451 | 464 | |
452 | 465 | >>> data = { |
453 | 466 | ... 'drinks-COUNT': '2', |
| 467 | ... 'drinks-REQUIRED': '0', # number of forms filled before |
454 | 468 | ... 'drinks-0-name': 'Gin and Tonic', |
455 | 469 | ... 'drinks-1-name': 'Gin and Tonic', |
456 | 470 | ... } |
… |
… |
Make sure we didn't break the valid case.
|
471 | 485 | |
472 | 486 | >>> data = { |
473 | 487 | ... 'drinks-COUNT': '2', |
| 488 | ... 'drinks-REQUIRED': '0', # number of forms filled before |
474 | 489 | ... 'drinks-0-name': 'Gin and Tonic', |
475 | 490 | ... 'drinks-1-name': 'Bloody Mary', |
476 | 491 | ... } |