def get_context_data(self, **kwargs):
        context = super(ProjectListView, self).get_context_data(**kwargs)

        try:
            phrase = self.kwargs['phrase']
        except:
            phrase = ""

        projects = context['object_list']
        context['top_n_badges'] = top_n_badge_winners(projects,5)
        context['badge_awards'] = project_badge_awards(projects)
        context['badge_awards_json'] = json.dumps(context['badge_awards'])
        context['project'] = projects[0]
        context['properties_json'] = json.dumps(projects[0].properties or {})
        nodes = Team.objects.all().order_by('tree_id','lft')

        for team in nodes:
            team.points = project_team_points(projects[0],team)
            team.memberpoints = team_project_member_points(team,projects[0])

        context['nodes'] = list(nodes)


        context['code'] = phrase
        if projects[0].visual_theme:
            try:
                files = get_files_in_dir("gamification/static/themes/" + projects[0].visual_theme)
                js_files = [ f for f in files if f.endswith(".js") ]

                context['theme_files'] = json.dumps(js_files, ensure_ascii=False)
                context['theme_files_js'] = [ f for f in files if f.endswith(".js") ]
                context['theme_files_css'] = [ f for f in files if f.endswith(".css") ]
            except Exception, e:
                context['theme_files_error'] = str(e)
    def get_context_data(self, **kwargs):
        context = super(ProjectListView, self).get_context_data(**kwargs)

        try:
            phrase = self.kwargs['phrase']
        except:
            phrase = ""

        projects = context['object_list']
        context['top_n_badges'] = top_n_badge_winners(projects,5)
        context['badge_awards'] = project_badge_awards(projects)
        context['badge_awards_json'] = json.dumps(context['badge_awards'])
        context['project'] = projects[0]
        context['properties_json'] = json.dumps(projects[0].properties or {})

        context['code'] = phrase
        if projects[0].visual_theme:
            try:
                files = get_files_in_dir("gamification/static/themes/" + projects[0].visual_theme)
                js_files = [ f for f in files if f.endswith(".js") ]

                context['theme_files'] = json.dumps(js_files, ensure_ascii=False)
                context['theme_files_js'] = [ f for f in files if f.endswith(".js") ]
                context['theme_files_css'] = [ f for f in files if f.endswith(".css") ]
            except Exception, e:
                context['theme_files_error'] = str(e)