def get(self, key): period = PerformanceReviewPeriod.get(key) prs = PerformanceReview.all().filter('period', period).fetch(1000) prs = sorted(prs, key=lambda x: x.employee.dept.name) for pr in prs: if get_prev_pr(pr): try: if get_prev_pr(pr).manager_form.get_all_data['salary'].\ value != pr.manager_form.get_all_data['salary'].value: pr.salary_highlight = 'highlight' if get_prev_pr(pr).manager_form.get_all_data['grade'].\ value != pr.manager_form.get_all_data['grade'].value: pr.grade_highlight = 'highlight' except AttributeError: pr.grade_highlight = None path = 'templates/detailed_report.html' self.response.out.write(template.render(path, {'prs': prs}))
def get(self, key): super(AddManagerForm, self).get(key) if self.form.type == "manager": prev_pr = get_prev_pr(self.form.pr) try: prev_form = prev_pr.forms.filter("type", self.form.type).get() prev_salary = prev_form.get_all_data["salary"] prev_grade = prev_form.get_all_data["grade"] except AttributeError: prev_salary = None prev_grade = None prev_position = self.form.pr.employee.position if prev_salary: salary = Salary(value=prev_salary.value, form=self.form) else: salary = Salary(value="N/A", form=self.form) salary.put() if prev_grade: grade = Grade(value=prev_grade.value, form=self.form) else: grade = Grade(value="N/A", form=self.form) grade.put() if prev_position: position = Position(value=prev_position, form=self.form) else: position = Position(value="N/A", form=self.form) position.put() conclusion = Conclusion(value="meet expectations", form=self.form) conclusion.put() self.redirect("/manager/pr/get/%(type)s/%(key)s" % {"type": self.type, "key": self.form.pr.key()})