Ejemplo n.º 1
0
 def post(self, request):
     content = request.data.get("content")
     if content is None:
         raise api_errors.MissingFieldError('content')
     doc_project = self.team.doc_project
     project = CodeDoubanProject.get(content)
     if not project:
         return {'content': doc_project and doc_project.name}
     team_projects = TeamProject.gets_by(team_id=self.team.id)
     team_project = team_projects[0] if team_projects else None
     if team_project:
         team_project.project_id = project.id
         team_project.save()
     else:
         TeamProject.create(team_id=self.team.id, project_id=project.id)
     return {'content': project.name}
Ejemplo n.º 2
0
 def doc_project(self):
     team_projects = TeamProject.gets_by(team_id=self.id)
     if not team_projects:
         return None
     team_project = team_projects[0]
     return team_project.project
Ejemplo n.º 3
0
 def doc_project(self):
     team_projects = TeamProject.gets_by(team_id=self.id)
     if not team_projects:
         return None
     team_project = team_projects[0]
     return team_project.project