def get(self): departments = Department.all() comp = None for dep in departments: course = Course(cour_name = 'course1 of '+ dep.dep_name, cour_department=dep) course.put() if dep.dep_name == 'Department of Computer Science and Information Engineering': comp = dep i2c = Course(cour_name = 'Introduction to Computers', cour_department=comp) i2c.put() template_values = {'title': 'data loaded', 'message': 'courses loaded', 'method': 'get', 'action': '/', 'value': 'continue' } path = os.path.join(os.path.dirname(__file__), 'html/message.html') self.response.out.write(template.render(path, template_values))