diff options
| author | Tim Graham <timograham@gmail.com> | 2014-12-04 08:22:45 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-12-12 11:49:44 -0500 |
| commit | c64286c62b5960387d5e8fc3e28cd37662bda6cb (patch) | |
| tree | 6f37a7bd88ce744ccbab44f9df5642aa04913fd1 /tests | |
| parent | 4b96e862b4674e85d1a28f2849685aa3135bc557 (diff) | |
[1.7.x] Fixed #23857 -- Fixed admin crash with "save as new" and deleting inline.
Thanks amarandon for the report.
Backport of c7a19f42030c15ad3b3475ad9a4854e10733ff74 from master
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/admin_views/tests.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index b801fedbbb..96da7c438e 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -251,6 +251,23 @@ class AdminViewBasicTest(AdminViewBasicTestCase): response = self.client.post('/test_admin/%s/admin_views/section/1/' % self.urlbit, post_data) self.assertEqual(response.status_code, 302) # redirect somewhere + def test_edit_save_as_delete_inline(self): + """ + Should be able to "Save as new" while also deleting an inline. + """ + post_data = self.inline_post_data.copy() + post_data.update({ + '_saveasnew': 'Save+as+new', + "article_set-1-section": "1", + "article_set-2-section": "1", + "article_set-2-DELETE": "1", + "article_set-3-section": "1", + }) + response = self.client.post('/test_admin/%s/admin_views/section/1/' % self.urlbit, post_data) + self.assertEqual(response.status_code, 302) + # started with 3 articles, one was deleted. + self.assertEqual(Section.objects.latest('id').article_set.count(), 2) + def test_change_list_sorting_callable(self): """ Ensure we can sort on a list_display field that is a callable |
