Merge pull request #912 from normanjaeckel/Fix910

Fix wrong question_url_name in ItemDelete view. Fix #910.
This commit is contained in:
Oskar Hahn 2013-10-17 22:36:04 -07:00
commit d3f673a276
2 changed files with 8 additions and 0 deletions

View File

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

View File

@ -207,6 +207,13 @@ class ViewTest(TestCase):
self.assertIsNone(Item.objects.get(pk=1).parent)
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):
def setUp(self):