def make_pokemon(self, name, type_name): trainer_id = users.get_current_user().user_id() pokemon = Pokemon(parent=trainer_key(trainer_id)) #Define a Trainer as the parent of the new pokemon. This trainer's key is the current user id. Thus every user has his own pokemon list pokemon.img_url = self.get_pokemon_image(name) pokemon.name = name pokemon.type = Type.query(Type.name == type_name).get() return pokemon
def fetch_types(): type_query = Type.query() types = type_query.fetch() if not types: return init_types() else: return types