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')
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))
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))
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))
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))
def get(self): dep = Department.get(self.request.get('key')) values = {'dep': dep} self.response.out.write(template.render('templates/editdepartment.html', values))
def post(self): dep = Department(name=self.request.get('name'), description=self.request.get('description')) dep.put() self.redirect('/department')
def get(self): dep = Department.get(self.request.get('key')) dep.delete() self.redirect('/department')