diff --git a/opentech/apply/categories/blocks.py b/opentech/apply/categories/blocks.py index b50ebba7ef8c4217c865dd9cccf4bd79e76d3da6..02359dc54c454236183c6407d962f59fc8e4c687 100644 --- a/opentech/apply/categories/blocks.py +++ b/opentech/apply/categories/blocks.py @@ -77,7 +77,7 @@ class CategoryQuestionBlock(OptionalFormFieldBlock): def render(self, value, context): data = context['data'] category = value['category'] - if data != self.no_response(): + if data: context['data'] = category.options.filter(id__in=data).values_list('value', flat=True) return super().render(value, context) diff --git a/opentech/apply/categories/tests/test_blocks.py b/opentech/apply/categories/tests/test_blocks.py index 979b4df24b1f67136d247612a6724e306df7f0f2..c436308019ffc4e913bc109e999e2f6e576de9e4 100644 --- a/opentech/apply/categories/tests/test_blocks.py +++ b/opentech/apply/categories/tests/test_blocks.py @@ -54,7 +54,5 @@ class TestCategoryQuestionBlock(TestCase): ) def test_can_render_if_no_response(self): - context = self.block.get_context(None, {'data': None}) - self.assertEqual(context['data'], self.block.no_response()) - display = self.block.render({'category': self.category}, context) + display = self.block.render({'category': self.category}, {'data': None}) self.assertIn(self.block.no_response()[0], display)