def get_queryset(self):
        level_to_get = None
        res_type = None
        slug = self.kwargs['slug']
        try:
            res_type = self.kwargs['res_type']
        except KeyError:
            pass
        if 'level' in self.request.GET:
            level_to_get = self.request.GET['level']
        topic = get_object_or_404(Topic, slug=slug)
        resources = topic.resource_set.all()
        self.headline = 'All ' + unicode(topic.name).capitalize() +' Resources'
        if res_type:
            res_type = get_object_or_404(ResourceType, slug=res_type)
            resources = resources.filter(resource_type=res_type)
            self.headline = unicode(topic.name).capitalize() +' Resources' + ' (' + unicode(res_type.name) + 's)'
        if level_to_get and level_to_get != 'all':
            resources = resources.filter(level=level_to_get)
        return resources
dataset/ETHPy150Open codesters/codesters/resources/views.py/ResourceTopicListView.get_queryset/original