def add_card(house_name, key, value): house_list = House.query(House.name == house_name).fetch() if house_list: card = Card(card_key=key, value=value) house = house_list[0] card.key = ndb.Key(Card, key, parent=house.key) card.put() return
def post(self): user = users.get_current_user() user_id = user.user_id() current_user = Profile.query().filter(Profile.user_id == user_id).get() the_question = self.request.get('question') the_answer = self.request.get('answer') difficulty = int(self.request.get('difficulty_selection')) card = Card(question=the_question, answer=the_answer, level=difficulty, owner=user.user_id()) card.put() self.redirect('/create')