コード例 #1
0
ファイル: views.py プロジェクト: jcechak/flocs
def get_task_by_id(request, id):
    """Get task by its id.
    """
    try:
        task = task_service.get_task_by_id(id)
    except LookupError as ex:
        raise Http404(ex)

    return JsonResponse(task)
コード例 #2
0
ファイル: views.py プロジェクト: MatheusArrudaLab/flocos
def get_task_by_id(request, id):
    """Get task by its id.

    Example of returned task:
    {
        "task-id": 1,
        "title": "Three steps forward",
        "maze-settings": {
            "grid": [ ... ]
            "hero": {
                "position": [1, 4],
                "direction": 0
            }
        },
    }
    """
    try:
        task = task_service.get_task_by_id(id)
    except LookupError as ex:
        raise Http404(ex)

    return JsonResponse(task)