コード例 #1
0
ファイル: main.py プロジェクト: mbchiorean/yonderproject
 def post(self):
     
     session = Session()
     if session["pos"] == 1 or session["pos"] == 4:
         raw_id = self.request.get('projId')
         id=int(raw_id)
         project = Project.get_by_id(id)
         project.name = self.request.get('projName')
         project.type = self.request.get('projType')
         project.description = self.request.get('projDescription')
         project.pmid = int(self.request.get('projPmId'))
     
         start = self.request.get('projStartD')
         end = self.request.get('projEndD')
         start_date = date(int(start.split('-')[0]),int(start.split('-')[1]),int(start.split('-')[2]))
         end_date = date(int(end.split('-')[0]),int(end.split('-')[1]),int(end.split('-')[2]))
         
         project.startdate = start_date
         project.enddate = end_date
         
         project.save()
     
         self.redirect('/projects')
     else:
         self.redirect("/nouser")
コード例 #2
0
ファイル: main.py プロジェクト: mbchiorean/yonderproject
 def post(self):
     
     session = Session()
     if session["pos"] == 1 or session["pos"] == 4:
         start = self.request.get('projStartD')
         end = self.request.get('projEndD')
         start_date = date(int(start.split('-')[0]),int(start.split('-')[1]),int(start.split('-')[2]))
         end_date = date(int(end.split('-')[0]),int(end.split('-')[1]),int(end.split('-')[2]))
         project = Project(name=self.request.get('projName'),
                           type=self.request.get('projType'),
                           description = self.request.get('projDescription'),
                           startdate = start_date,
                           enddate = end_date,
                           pmid = int(self.request.get('projPmId'))
                           )
         project.put()
         self.redirect("/projects")
     else:
         self.redirect("/nouser")
コード例 #3
0
ファイル: main.py プロジェクト: mbchiorean/yonderproject
 def get(self):
     
     session = Session()        
     if session["pos"] == 1 or session["pos"] == 4:
         projects = Project.all()
         noprojects = projects.count()
         values = {'projects' : projects,
                   'noprojects' : noprojects,
                   'url' : session["url"]
                   }
         self.render_response("projects.html", **values)
     else:
         self.redirect("/nouser")
コード例 #4
0
ファイル: main.py プロジェクト: mbchiorean/yonderproject
 def get(self):
     
     session = Session()
     if session["pos"] == 1 or session["pos"] == 4:
         raw_id = self.request.get('id')
         id = int(raw_id)
         project = Project.get_by_id(id)
         vals={'id' : id,
               'project' : project,
               'url' : session["url"]}
         self.render_response("editproj.html", **vals)
     else:
         self.redirect("/nouser")
コード例 #5
0
ファイル: main.py プロジェクト: mbchiorean/yonderproject
 def get(self):
     
     session = Session()
     if session["pos"] == 1 or session["pos"] == 4:
         project =Project.get_by_id(int(self.request.get('projid')))
         employee= Employee.get_by_id(int(self.request.get('emplid')))
         emplon = EmployeeOnProject(proj=project, empl=employee)
         emplon.put()
         employee.assigned = True
         employee.save()
         link = "/emplalocpage?id=" + str(self.request.get('projid'))
         self.redirect(link)
     else:
         self.redirect("/nouser")
コード例 #6
0
ファイル: main.py プロジェクト: mbchiorean/yonderproject
 def get(self):
     
     session = Session()
     if session["pos"] == 1 or session["pos"] == 4:
         raw_id = self.request.get('id')
         id = int(raw_id)
         proj = Project.get_by_id(id)
         emplonp = proj.employeeonproject_set
         for eop in emplonp:
             eop.empl.assigned = False
             eop.empl.save()
             eop.delete()
         proj.delete()
         self.redirect('/projects')
     else:
         self.redirect("/nouser")
コード例 #7
0
    def projects():
        auth = session.get('auth')
        if auth:
            user: User = User.query.filter_by(email=auth.get('email')).first()
            if not user:
                session['auth'] = {}
                return redirect('/login')
            if request.method == 'POST':
                name = request.form['projectName']
                description = request.form['projectDescription']
                pro = Project(name=name, description=description)
                db.session.add(pro)
                user.project.append(pro)
                db.session.commit()

            grid = user.get_project_grid(3)
            return render_template('projects.html', projectgrid=grid)
        return redirect('/login')
コード例 #8
0
ファイル: test.py プロジェクト: andrewjschuang/Turing
    def test_usr_add_tsk2_prj(self):
        user = User(email='em', name='us', password='******')
        db.session.add(user)
        db.session.commit()

        project = Project(name='n', description='desc')
        db.session.add(project)
        user.project.append(project)
        db.session.commit()

        project: Project = User.query.filter_by(email='em').first().project[0]

        task = Task(name='n', description='desc')
        db.session.add(task)

        project.tasks.append(task)
        db.session.commit()

        assert user.project[0].tasks[0] == task
コード例 #9
0
ファイル: main.py プロジェクト: mbchiorean/yonderproject
 def get(self):
     
     session = Session()
     if session["pos"] == 1 or session["pos"] == 4:
         raw_id = self.request.get('id')
         id = int(raw_id)
         employee_list = Employee.gql("WHERE assigned = False and position != :1", "Project Manager")
         noempl = employee_list.count()
         project = Project.get_by_id(id)
         employeesonthisproject = [angaj.empl for angaj in project.employeeonproject_set]
         noemplonthis = len(employeesonthisproject)
         vals = { 'noempl' : noempl,
                  'employees' : employee_list,
                  'project' : project,
                  'employeesonthis' : employeesonthisproject,
                  'noemplonthis' : noemplonthis,
                  'url' : session["url"]
                 }
         self.render_response("employeealoc.html", **vals)
     else:
         self.redirect("/nouser")
コード例 #10
0
ファイル: test.py プロジェクト: andrewjschuang/Turing
 def test_project(self):
     project = Project(name='n', description='desc')
     db.session.add(project)
     db.session.commit()
     assert project in db.session