def showHome(self): """ Sets up template data and renders homepage template. """ homepage = Config.get('homepage') features = Config.get('features') locationData = mLocation.getSimpleLocationDictionary(self.db) allIdeasData = mIdea.getMostRecentIdeas(self.db, homepage['num_recent_ideas']); locations = dict(data = locationData, json = json.dumps(locationData)) allIdeas = dict(data = allIdeasData, json = json.dumps(allIdeasData)) news = self.getNewsItems() if (bool(features.get('is_display_leaderboard'))): leaderboardProjects = mProject.getLeaderboardProjects(self.db, 6) self.template_data['leaderboard'] = leaderboardProjects if (bool(features.get('is_display_featured_projects'))): featuredProjects = mProject.getFeaturedProjects(self.db, 6) self.template_data['featured_projects'] = featuredProjects if (bool(features.get('is_community_leaders_displayed'))): community_leaders = self.orm.query(models.CommunityLeader) \ .order_by('`order`') \ .all() self.template_data['community_leaders'] = community_leaders self.template_data['locations'] = locations self.template_data['all_ideas'] = allIdeas self.template_data['news'] = news return self.render('home', {'locations':locations, 'all_ideas':allIdeas})
def showHome(self): """ Sets up template data and renders homepage template. """ homepage = Config.get("homepage") features = Config.get("features") locationData = mLocation.getSimpleLocationDictionary(self.db) allIdeasData = mIdea.getMostRecentIdeas(self.db, homepage["num_recent_ideas"]) locations = dict(data=locationData, json=json.dumps(locationData)) allIdeas = dict(data=allIdeasData, json=json.dumps(allIdeasData)) news = self.getNewsItems() if bool(features.get("is_display_leaderboard")): leaderboardProjects = mProject.getLeaderboardProjects(self.db, 6) self.template_data["leaderboard"] = leaderboardProjects if bool(features.get("is_display_featured_projects")): featuredProjects = mProject.getFeaturedProjects(self.db, 6) self.template_data["featured_projects"] = featuredProjects if bool(features.get("is_community_leaders_displayed")): community_leaders = self.orm.query(models.CommunityLeader).order_by("`order`").all() self.template_data["community_leaders"] = community_leaders self.template_data["locations"] = locations self.template_data["all_ideas"] = allIdeas self.template_data["news"] = news return self.render("home", {"locations": locations, "all_ideas": allIdeas})
def showHome(self): """ Sets up template data and renders homepage template. """ homepage = Config.get('homepage') features = Config.get('features') locationData = mLocation.getSimpleLocationDictionary(self.db) allIdeasData = mIdea.getMostRecentIdeas(self.db, homepage['num_recent_ideas']) locations = dict(data=locationData, json=json.dumps(locationData)) allIdeas = dict(data=allIdeasData, json=json.dumps(allIdeasData)) news = self.getNewsItems() if (bool(features.get('is_display_leaderboard'))): leaderboardProjects = mProject.getLeaderboardProjects(self.db, 6) self.template_data['leaderboard'] = leaderboardProjects if (bool(features.get('is_display_featured_projects'))): featuredProjects = mProject.getFeaturedProjects(self.db, 6) self.template_data['featured_projects'] = featuredProjects if (bool(features.get('is_community_leaders_displayed'))): community_leaders = self.orm.query(models.CommunityLeader) \ .order_by('`order`') \ .all() self.template_data['community_leaders'] = community_leaders self.template_data['locations'] = locations self.template_data['all_ideas'] = allIdeas self.template_data['news'] = news return self.render('home', { 'locations': locations, 'all_ideas': allIdeas })
def showLeaderboard(self): leaderboardProjects = mProject.getLeaderboardProjects(self.db, 10) self.template_data['leaderboard'] = leaderboardProjects return self.render('leaderboard')