Merge pull request #941 from normanjaeckel/UrlNameArgsFix

Fix url_name_args bug.
This commit is contained in:
Oskar Hahn 2013-10-21 14:43:45 -07:00
commit b0b91e94c0
3 changed files with 23 additions and 0 deletions

View File

@ -773,6 +773,7 @@ class CategoryDeleteView(DeleteView):
permission_required = 'motion.can_manage_motion'
model = Category
question_url_name = 'motion_category_list'
url_name_args = []
success_url_name = 'motion_category_list'
category_delete = CategoryDeleteView.as_view()

View File

@ -491,3 +491,14 @@ class CategoryViewsTest(TestCase):
response = self.admin_client.post(url, {'name': 'test_title_jaiShae1sheingahlee2'})
self.assertRedirects(response, '/motion/category/')
self.assertEqual(Category.objects.get(pk=1).name, 'test_title_jaiShae1sheingahlee2')
def test_delete(self):
# Setup
url = '/motion/category/1/del/'
Category.objects.create(name='test_title_nei1wooHes2aiquuraep')
# Test
response = self.admin_client.get(url)
self.assertRedirects(response, '/motion/category/')
response = self.admin_client.post(url, {'yes': 'true'})
self.assertRedirects(response, '/motion/category/')
self.assertFalse(Category.objects.exists())

View File

@ -40,3 +40,14 @@ class CustomSlidesTest(TestCase):
response = self.admin_client.post(url, {'title': 'test_title_ai8Ooboh5bahr6Ee7goo', 'weight': '0'})
self.assertRedirects(response, '/projector/dashboard/')
self.assertEqual(ProjectorSlide.objects.get(pk=1).title, 'test_title_ai8Ooboh5bahr6Ee7goo')
def test_delete(self):
# Setup
url = '/projector/1/del/'
ProjectorSlide.objects.create(title='test_title_oyie0em1chieM7YohX4H')
# Test
response = self.admin_client.get(url)
self.assertRedirects(response, '/projector/1/edit/')
response = self.admin_client.post(url, {'yes': 'true'})
self.assertRedirects(response, '/projector/dashboard/')
self.assertFalse(ProjectorSlide.objects.exists())