def get_answers_by_question_id(self, question_id): #don't need call entity service for single get operation question = Question.get_by_id(int(question_id)) answers = Answer.query(ancestor = question.key).fetch() return answers
def update_answer_num(self, question_key): question = question_key.get() if question: answers_num = Answer.query(ancestor=question_key).count() question.answers_num = answers_num question.put()
def get_answers_by_question_key(self, question_key, keys_only = True): answers = Answer.query(ancestor = question_key).fetch(keys_only = keys_only) return answers