예제 #1
0
def change_task_field(request, task_id, field_name):
    """Change a task field to the POSTed value."""
    task = get_object_or_404(Task, pk=task_id)
    value, is_valid = _validate_field_value(field_name,
                                            request.POST.get(field_name))
    if not is_valid:
        return json_r({}, HttpResponseBadRequest)
    setattr(task, field_name, value)
    task.save()
    return json_r({field_name: getattr(task, field_name)})
예제 #2
0
def change_task_field(request, task_id, field_name):
    """Change a task field to the POSTed value."""
    task = get_object_or_404(Task, pk=task_id)
    value, is_valid = _validate_field_value(field_name,
                                            request.POST.get(field_name))
    if not is_valid:
        return json_r({}, HttpResponseBadRequest)
    setattr(task, field_name, value)
    task.save()
    return json_r({field_name: getattr(task, field_name)})
예제 #3
0
def all(request):
    counts = [[2, 0, 4, 12], [1, 11]]
    folders = _get_folders(request)
    pager = ['', '']
    tasks = _get_tasks(request)
    friends = user_views.get_friends(request)
    return json_r({'counts': counts, 'groups': folders, 'pager': pager,
                    'tasks': tasks, 'friends': friends})
예제 #4
0
def all(request):
    counts = [[2, 0, 4, 12], [1, 11]]
    folders = _get_folders(request)
    pager = ['', '']
    tasks = _get_tasks(request)
    friends = user_views.get_friends(request)
    return json_r({
        'counts': counts,
        'groups': folders,
        'pager': pager,
        'tasks': tasks,
        'friends': friends
    })
예제 #5
0
def new_task(request):
    # TODO: use forms
    return json_r({'TODO': True})
예제 #6
0
def folders(request):
    results = _get_folders(request)
    return json_r({'results': results})
예제 #7
0
def friends(request):
    return json_r(get_friends(request))
예제 #8
0
def available(request):
    form = UserForm(request.POST)
    available = 0
    if form.is_valid():
        available = 1
    return json_r({'available': available})
예제 #9
0
def new_task(request):
    # TODO: use forms
    return json_r({'TODO': True})
예제 #10
0
def folders(request):
    results = _get_folders(request)
    return json_r({'results': results})