Beispiel #1
0
def index():
    """首页视图函数"""
    # 倒序排序,最近添加的 todo 排在前面
    todo_list = Todo.all(sort=True, reverse=True)
    context = {
        'todo_list': todo_list,
    }
    return render_template('index.html', **context)
Beispiel #2
0
def all(request):
    todo_list = Todo.all()
    return JsonResponse(todo_list)