Example #1
0
def projectPage(projectName):
  currentUser = getCurrentUser()
  project = ProjectModel.getProjectByProjectName(projectName)

  if project == None:
    return render_template(
      "not-found.html",
      title = "Project Not Found!",
      msg = "The project you trying to access not found!",
      currentUser = getCurrentUser()
      )

  projectLinks = ProjectModel.getProjectLinks(project["pid"])
  lastProjectPosts = ProjectPostModel.getLastProjectPosts(project["pid"], 10, getCurrentUid())
  numberOfMembers = ProjectModel.getNumberOfMembers(project["pid"])
  numberOfEmptySeaters = SeaterModel.getProjectEmptySeaterNumber(project["pid"])
  popularProjects = ProjectModel.getPopularProjects(10)
  whoToFollowList = UserModel.getWhoToFollowList(5, getCurrentUid())


  return render_template(
    "project-page.html",
    currentUser = currentUser,
    project = project,
    projectLinks = projectLinks,
    lastProjectPosts = lastProjectPosts,
    numberOfMembers = numberOfMembers,
    numberOfEmptySeaters = numberOfEmptySeaters,
    popularProjects = popularProjects,
    whoToFollowList = whoToFollowList
    )
Example #2
0
def getNumberOfMembers(pid):
    number = ProjectModel.getNumberOfMembers(pid)

    return json.dumps({"number": number})