Fix wrong url_name_args in ItemDelete view. Fix #910.

This commit is contained in:
Norman Jäckel 2013-10-17 01:28:29 +02:00
parent 21da6c24a8
commit d76a04f443
2 changed files with 8 additions and 0 deletions

View File

@ -243,6 +243,7 @@ class ItemDelete(DeleteView):
model = Item model = Item
question_url_name = 'item_overview' question_url_name = 'item_overview'
success_url_name = 'item_overview' success_url_name = 'item_overview'
url_name_args = []
def get_answer_options(self): def get_answer_options(self):
if self.object.children.exists(): if self.object.children.exists():

View File

@ -207,6 +207,13 @@ class ViewTest(TestCase):
self.assertIsNone(Item.objects.get(pk=1).parent) self.assertIsNone(Item.objects.get(pk=1).parent)
self.assertEqual(Item.objects.get(pk=2).parent_id, 1) self.assertEqual(Item.objects.get(pk=2).parent_id, 1)
def test_delete(self):
response = self.adminClient.get('/agenda/%s/del/' % self.item1.pk)
self.assertRedirects(response, '/agenda/')
response = self.adminClient.post('/agenda/%s/del/' % self.item1.pk, {'yes': 1})
self.assertRedirects(response, '/agenda/')
self.assertFalse(Item.objects.filter(pk=1).exists())
class ConfigTest(TestCase): class ConfigTest(TestCase):
def setUp(self): def setUp(self):