コード例 #1
0
ファイル: level_editor.py プロジェクト: jishi9/rapid-router
def load_level_for_editor(request, levelID):
    level = get_object_or_404(Level, id=levelID)

    if not permissions.can_load_level(request.user, level):
        return HttpResponseUnauthorized()

    level_dict = model_to_dict(level)
    level_dict['decor'] = level_management.get_decor(level)
    level_dict['blocks'] = level_management.get_blocks(level)

    response = {'owned': level.owner == request.user.userprofile, 'level': level_dict}

    return HttpResponse(json.dumps(response), content_type='application/javascript')
コード例 #2
0
def load_level_for_editor(request, levelID):
    level = get_object_or_404(Level, id=levelID)

    if not permissions.can_load_level(request.user, level):
        return HttpResponseUnauthorized()

    level_dict = LevelSerializer(level).data
    level_dict["theme"] = level.theme.id
    level_dict["decor"] = cached_level_decor(level)
    level_dict["blocks"] = cached_level_blocks(level)

    response = {"owned": level.owner == request.user.userprofile, "level": level_dict}

    return HttpResponse(json.dumps(response), content_type="application/javascript")
コード例 #3
0
def load_level_for_editor(request, levelID):
    level = get_object_or_404(Level, id=levelID)

    if not permissions.can_load_level(request.user, level):
        return HttpResponseUnauthorized()

    level_dict = LevelSerializer(level).data
    level_dict["theme"] = level.theme.id
    level_dict["decor"] = cached_level_decor(level)
    level_dict["blocks"] = cached_level_blocks(level)

    response = {
        "owned": level.owner == request.user.userprofile,
        "level": level_dict
    }

    return HttpResponse(json.dumps(response),
                        content_type="application/javascript")