def get(self, request, *args, **kwargs):
        # TODO:  put in a try block
        program = Program.objects.prefetch_related('level_tiers').get(
            pk=int(self.kwargs['program_id']))
        role = request.user.tola_user.program_role(program.id)

        if not role or (role in ['low', 'medium']
                        and program.level_tiers.count() == 0):
            return HttpResponseRedirect('/')

        tiers = LevelTier.objects.filter(program=program)
        try:
            custom_tiers = LevelTierTemplate.objects.get(program=program)
        except LevelTierTemplate.DoesNotExist:
            custom_tiers = None
        levels = Level.objects.filter(program=program)
        # All indicators associated with the program should be passed to the front-end, not just the ones
        # associated with the rf levels.  The front-end uses the overall count to determine whether
        # the program name in the header should be plain text or a link.
        indicators = Indicator.objects.filter(program=program,
                                              deleted__isnull=True)

        translated_templates = json.dumps(LevelTier.get_templates(),
                                          cls=LazyEncoder)
        old_lang = translation.get_language()
        translation.activate('en')
        untranslated_templates = json.dumps(LevelTier.get_templates(),
                                            cls=LazyEncoder)
        translation.activate(old_lang)
        js_context = {
            'program':
            ResultsFrameworkProgramSerializer(program).data,
            'levels':
            LevelSerializer(levels, many=True).data,
            'indicators':
            IndicatorSerializerMinimal(indicators, many=True).data,
            'levelTiers':
            LevelTierSerializer(tiers, many=True).data,
            'tierTemplates':
            translated_templates,
            'englishTemplates':
            untranslated_templates,
            'customTemplates':
            LevelTierTemplateSerializer(custom_tiers).data,
            'programObjectives':
            ProgramObjectiveSerializer(program.objective_set.all(),
                                       many=True).data,
            'accessLevel':
            role,
            'usingResultsFramework':
            program.results_framework,
        }

        context_data = {
            'program': program,
            'indicator_count': indicators.count(),
            'js_context': js_context,
        }
        return render(request, self.template_name, context_data)
def indicator_list(request, program_id):

    program = Program.objects.get(pk=program_id)
    if not request.user.tola_user.program_role(program.id):
        return JsonResponse({'message': _('Your request could not be processed.')}, status=400)

    filter_name_map = {'levelId': 'level_id', 'indicatorId': 'pk'}
    filters = {filter_name_map[key]: request.GET.get(key) for key in filter_name_map if request.GET.get(key, None)}

    indicators = Indicator.objects.filter(program=program, **filters)

    return JsonResponse(IndicatorSerializerMinimal(indicators, many=True).data, safe=False, status=200)