Esempio n. 1
0
 def post(self):
   emp = Employee(firstname=self.request.get('firstname'), 
                  lastname=self.request.get('lastname'), 
                  department_ref=Department.get(self.request.get('department_key')))
       
   emp.put()
   self.redirect('/employee')
Esempio n. 2
0
 def get(self):
   emp = Employee.get(self.request.get('key'))
   deps = Department.all()
   values = {
             'emp': emp,
             'deps': deps
             }
   self.response.out.write(template.render('templates/editemployee.html', values))
Esempio n. 3
0
 def get(self):
   depkey = self.request.get('key')
   dep = Department.get(depkey)
   emps = db.GqlQuery('SELECT * FROM Employee WHERE department_ref = :1', dep)
   values = {
             'dep': dep,
             'emps': emps 
             }
   self.response.out.write(template.render('templates/details.html', values))
Esempio n. 4
0
 def post(self):
   emp = Employee.get(self.request.get('key'))
   emp.firstname = self.request.get('firstname') 
   emp.lastname = self.request.get('lastname')
   
   dep = Department.get(self.request.get('department_key'))
   emp.department_ref = dep
   emp.put()
   
   message = 'Changes saved' 
   deps = Department.all()
   values = {
             'emp': emp,
             'deps': deps,
             'message': message
             }
   
   self.response.out.write(template.render('templates/editemployee.html', values))
Esempio n. 5
0
  def post(self):
    
    dep = Department.get(self.request.get('key'))
  
    dep.name = self.request.get('name') 
    dep.description = self.request.get('description')
    dep.put()
    
    message = 'Changes saved'
    values = {'dep': dep,
              'message': message }

    self.response.out.write(template.render('templates/editdepartment.html', values))
Esempio n. 6
0
 def get(self):
   dep = Department.get(self.request.get('key'))
   values = {'dep': dep}
   self.response.out.write(template.render('templates/editdepartment.html', values))
Esempio n. 7
0
 def post(self):
   dep = Department(name=self.request.get('name'),
                    description=self.request.get('description'))
   dep.put()
   self.redirect('/department')
Esempio n. 8
0
 def get(self):
   dep = Department.get(self.request.get('key'))
   dep.delete()
   self.redirect('/department')