Ejemplo n.º 1
0
def index(_logged_user, game_id):
    game = Game.get_by_id(long(game_id))
    quests = Quest.query().fetch()
    quest_list = [quest.to_dict(exclude=["jog"]) for quest in quests if quest.jog.id() == game.key.id()]
    dict_ = {
        'game': json.dumps(game.to_dict()),
        'quests': json.dumps(quest_list)
    }
    return TemplateResponse(context=dict_, template_path="jogar/jogar.html")
Ejemplo n.º 2
0
def pergunta(game_id):
    quest_form = QuestForm()
    quests = [quest_form.fill_with_model(quest) for quest in Quest.query().fetch()]

    return TemplateResponse({"quests": quests, "game_id": game_id}, template_path="gerenciar/pergunta.html")
Ejemplo n.º 3
0
def all(game_id):
    game = Game.get_by_id(long(game_id))
    if game is not None:
        quests = Quest.query(Quest.jog==game.key).fetch()
        return JsonResponse([quest.to_dict(exclude=["jog"]) for quest in quests])
    raise Exception("game id: %s not found" % game_id)