1329 | | # def test_char_pk_inline(self): |
1330 | | # "A model with a character PK can be saved as inlines. Regression for #10992" |
1331 | | # # First add a new inline |
1332 | | # self.post_data['doohickey_set-0-code'] = "DH1" |
1333 | | # self.post_data['doohickey_set-0-name'] = "Doohickey 1" |
1334 | | # response = self.client.post('/test_admin/admin/admin_views/collector/1/', self.post_data) |
1335 | | # self.failUnlessEqual(response.status_code, 302) |
1336 | | # self.failUnlessEqual(DooHickey.objects.count(), 1) |
1337 | | # self.failUnlessEqual(DooHickey.objects.all()[0].name, "Doohickey 1") |
1338 | | # |
1339 | | # # Check that the PK link exists on the rendered form |
1340 | | # response = self.client.get('/test_admin/admin/admin_views/collector/1/') |
1341 | | # self.assertContains(response, 'name="doohickey_set-0-code"') |
1342 | | # |
1343 | | # # Now resave that inline |
1344 | | # self.post_data['doohickey_set-INITIAL_FORMS'] = "1" |
1345 | | # self.post_data['doohickey_set-0-code'] = "DH1" |
1346 | | # self.post_data['doohickey_set-0-name'] = "Doohickey 1" |
1347 | | # response = self.client.post('/test_admin/admin/admin_views/collector/1/', self.post_data) |
1348 | | # self.failUnlessEqual(response.status_code, 302) |
1349 | | # self.failUnlessEqual(DooHickey.objects.count(), 1) |
1350 | | # self.failUnlessEqual(DooHickey.objects.all()[0].name, "Doohickey 1") |
1351 | | # |
1352 | | # # Now modify that inline |
1353 | | # self.post_data['doohickey_set-INITIAL_FORMS'] = "1" |
1354 | | # self.post_data['doohickey_set-0-code'] = "DH1" |
1355 | | # self.post_data['doohickey_set-0-name'] = "Doohickey 1 Updated" |
1356 | | # response = self.client.post('/test_admin/admin/admin_views/collector/1/', self.post_data) |
1357 | | # self.failUnlessEqual(response.status_code, 302) |
1358 | | # self.failUnlessEqual(DooHickey.objects.count(), 1) |
1359 | | # self.failUnlessEqual(DooHickey.objects.all()[0].name, "Doohickey 1 Updated") |
| 1329 | def test_char_pk_inline(self): |
| 1330 | "A model with a character PK can be saved as inlines. Regression for #10992" |
| 1331 | # First add a new inline |
| 1332 | self.post_data['doohickey_set-0-code'] = "DH1" |
| 1333 | self.post_data['doohickey_set-0-name'] = "Doohickey 1" |
| 1334 | response = self.client.post('/test_admin/admin/admin_views/collector/1/', self.post_data) |
| 1335 | self.failUnlessEqual(response.status_code, 302) |
| 1336 | self.failUnlessEqual(DooHickey.objects.count(), 1) |
| 1337 | self.failUnlessEqual(DooHickey.objects.all()[0].name, "Doohickey 1") |
| 1338 | |
| 1339 | # Check that the PK link exists on the rendered form |
| 1340 | response = self.client.get('/test_admin/admin/admin_views/collector/1/') |
| 1341 | self.assertContains(response, 'name="doohickey_set-0-code"') |
| 1342 | |
| 1343 | # Now resave that inline |
| 1344 | self.post_data['doohickey_set-INITIAL_FORMS'] = "1" |
| 1345 | self.post_data['doohickey_set-0-code'] = "DH1" |
| 1346 | self.post_data['doohickey_set-0-name'] = "Doohickey 1" |
| 1347 | response = self.client.post('/test_admin/admin/admin_views/collector/1/', self.post_data) |
| 1348 | self.failUnlessEqual(response.status_code, 302) |
| 1349 | self.failUnlessEqual(DooHickey.objects.count(), 1) |
| 1350 | self.failUnlessEqual(DooHickey.objects.all()[0].name, "Doohickey 1") |
| 1351 | |
| 1352 | # Now modify that inline |
| 1353 | self.post_data['doohickey_set-INITIAL_FORMS'] = "1" |
| 1354 | self.post_data['doohickey_set-0-code'] = "DH1" |
| 1355 | self.post_data['doohickey_set-0-name'] = "Doohickey 1 Updated" |
| 1356 | response = self.client.post('/test_admin/admin/admin_views/collector/1/', self.post_data) |
| 1357 | self.failUnlessEqual(response.status_code, 302) |
| 1358 | self.failUnlessEqual(DooHickey.objects.count(), 1) |
| 1359 | self.failUnlessEqual(DooHickey.objects.all()[0].name, "Doohickey 1 Updated") |
| 1360 | |
| 1361 | def test_integer_pk_inline(self): |
| 1362 | "A model with an integer PK can be saved as inlines. Regression for #10992" |
| 1363 | # First add a new inline |
| 1364 | self.post_data['whatsit_set-0-index'] = "42" |
| 1365 | self.post_data['whatsit_set-0-name'] = "Whatsit 1" |
| 1366 | response = self.client.post('/test_admin/admin/admin_views/collector/1/', self.post_data) |
| 1367 | self.failUnlessEqual(response.status_code, 302) |
| 1368 | self.failUnlessEqual(Whatsit.objects.count(), 1) |
| 1369 | self.failUnlessEqual(Whatsit.objects.all()[0].name, "Whatsit 1") |
| 1370 | |
| 1371 | # Check that the PK link exists on the rendered form |
| 1372 | response = self.client.get('/test_admin/admin/admin_views/collector/1/') |
| 1373 | self.assertContains(response, 'name="whatsit_set-0-index"') |
| 1374 | |
| 1375 | # Now resave that inline |
| 1376 | self.post_data['whatsit_set-INITIAL_FORMS'] = "1" |
| 1377 | self.post_data['whatsit_set-0-index'] = "42" |
| 1378 | self.post_data['whatsit_set-0-name'] = "Whatsit 1" |
| 1379 | response = self.client.post('/test_admin/admin/admin_views/collector/1/', self.post_data) |
| 1380 | self.failUnlessEqual(response.status_code, 302) |
| 1381 | self.failUnlessEqual(Whatsit.objects.count(), 1) |
| 1382 | self.failUnlessEqual(Whatsit.objects.all()[0].name, "Whatsit 1") |
| 1383 | |
| 1384 | # Now modify that inline |
| 1385 | self.post_data['whatsit_set-INITIAL_FORMS'] = "1" |
| 1386 | self.post_data['whatsit_set-0-index'] = "42" |
| 1387 | self.post_data['whatsit_set-0-name'] = "Whatsit 1 Updated" |
| 1388 | response = self.client.post('/test_admin/admin/admin_views/collector/1/', self.post_data) |
| 1389 | self.failUnlessEqual(response.status_code, 302) |
| 1390 | self.failUnlessEqual(Whatsit.objects.count(), 1) |
| 1391 | self.failUnlessEqual(Whatsit.objects.all()[0].name, "Whatsit 1 Updated") |
1361 | | # def test_integer_pk_inline(self): |
1362 | | # "A model with an integer PK can be saved as inlines. Regression for #10992" |
1363 | | # # First add a new inline |
1364 | | # self.post_data['whatsit_set-0-index'] = "42" |
1365 | | # self.post_data['whatsit_set-0-name'] = "Whatsit 1" |
1366 | | # response = self.client.post('/test_admin/admin/admin_views/collector/1/', self.post_data) |
1367 | | # self.failUnlessEqual(response.status_code, 302) |
1368 | | # self.failUnlessEqual(Whatsit.objects.count(), 1) |
1369 | | # self.failUnlessEqual(Whatsit.objects.all()[0].name, "Whatsit 1") |
1370 | | # |
1371 | | # # Check that the PK link exists on the rendered form |
1372 | | # response = self.client.get('/test_admin/admin/admin_views/collector/1/') |
1373 | | # self.assertContains(response, 'name="whatsit_set-0-index"') |
1374 | | # |
1375 | | # # Now resave that inline |
1376 | | # self.post_data['whatsit_set-INITIAL_FORMS'] = "1" |
1377 | | # self.post_data['whatsit_set-0-index'] = "42" |
1378 | | # self.post_data['whatsit_set-0-name'] = "Whatsit 1" |
1379 | | # response = self.client.post('/test_admin/admin/admin_views/collector/1/', self.post_data) |
1380 | | # self.failUnlessEqual(response.status_code, 302) |
1381 | | # self.failUnlessEqual(Whatsit.objects.count(), 1) |
1382 | | # self.failUnlessEqual(Whatsit.objects.all()[0].name, "Whatsit 1") |
1383 | | # |
1384 | | # # Now modify that inline |
1385 | | # self.post_data['whatsit_set-INITIAL_FORMS'] = "1" |
1386 | | # self.post_data['whatsit_set-0-index'] = "42" |
1387 | | # self.post_data['whatsit_set-0-name'] = "Whatsit 1 Updated" |
1388 | | # response = self.client.post('/test_admin/admin/admin_views/collector/1/', self.post_data) |
1389 | | # self.failUnlessEqual(response.status_code, 302) |
1390 | | # self.failUnlessEqual(Whatsit.objects.count(), 1) |
1391 | | # self.failUnlessEqual(Whatsit.objects.all()[0].name, "Whatsit 1 Updated") |
1392 | | |