Ejemplo n.º 1
0
 def create(self):
     params = self.request.body
     validator = Validator(params, "create", GradeHandler.valid_model)
     new_grade_data = validator.good_create_request()
     if new_grade_data:
         #     grade = Grade.create(new_grade_data)
         #     if grade:
         #         return ...
         new_grade = Grade(score=new_grade_data["score"])
         s_key = new_grade_data.get("student_key")
         if s_key:
             student = Student.get_by_id(s_key)
             if student:
                 new_grade.student = student.key
         new_grade.put()
         self.response.write(json.dumps(new_grade.dict()))
     else:
         self.response.write(json.dumps(validator.error_message()))
Ejemplo n.º 2
0
def createGrades(student,assignments):
    for assignment in assignments:
        g = Grade(score=int(random()*100))
        g.student = student.key
        g.assignment = assignment.key
        g.put()
Ejemplo n.º 3
0
def seedGrades():
    for i in range(0,10):
        g = Grade(
            score = int(random()*100)
            )
        g.put()