def _get_questions_based_on_filter(batch_id, filter_params): filter_params = clean_query_params(filter_params) if batch_id: filter_params = prepend_to_keys(filter_params, 'question__') return BatchQuestionOrder.get_batch_order_specific_questions( batch_id, filter_params) return Question.objects.filter( subquestion=False, **filter_params).exclude(group__name='REGISTRATION GROUP')
def test_append_text_to_all_keys(self): params = { 'batch__id': 1, 'question__text': 'haha', } self.assertEqual( { 'group__batch__id': 1, 'group__question__text': 'haha' }, prepend_to_keys(params, 'group__'))
def test_append_text_to_all_keys(self): params = {'batch__id': 1, 'question__text': 'haha', } self.assertEqual({'group__batch__id': 1, 'group__question__text': 'haha'}, prepend_to_keys(params, 'group__'))
def _get_questions_based_on_filter(batch_id, filter_params): filter_params = clean_query_params(filter_params) if batch_id: filter_params = prepend_to_keys(filter_params, "question__") return BatchQuestionOrder.get_batch_order_specific_questions(batch_id, filter_params) return Question.objects.filter(subquestion=False, **filter_params).exclude(group__name="REGISTRATION GROUP")