def index(request): query_string = request.GET.get('query_string', '') topics = None if query_string: topics = Fetcher.search_topics(Fetcher(), query_string) if topics: for index, val in enumerate(topics): title = get_edited_topic_name(val['guid']) if title: topics[index]['topic_group'] = title data = {'topics' : topics} context = RequestContext(request) context.update(data) return render_to_response('newscred/index.html', context)