예제 #1
0
def add():
    form = TodoForm(request.form)
    if form.validate():
        content = form.content.data
        todo = Todo(content=content, time=datetime.now())
        todo.save()
    return redirect(url_for('index'))
예제 #2
0
파일: views.py 프로젝트: NCZkevin/Darkwave
def add():
    form = TodoForm(request.form)
    if form.validate():
        content = form.content.data
        todo = Todo(content=content,time=datetime.now())
        todo.save()
    todos = Todo.objects.order_by('-time')
    return render_template("index.html",todos=todos,form=form)
예제 #3
0
def add():
    form = TodoForm(request.form)
    if form.validate():
        content = form.content.data
        todo = Todo(content=content)
        todo.save()
    todos = Todo.objects.order_by('-time')
    return render_template("index.html", todos=todos, form=form)
예제 #4
0
def add():
    form = TodoForm(request.form)
    if form.validate():
        content = form.content.data
        todo = Todo(content=content)
        todo.save()
    todos = Todo.objects.all()
    return render_template("index.html", todos=todos, form=form)
예제 #5
0
def add():
    form = TodoForm(request.form)
    if form.validate():
        content = form.content.data
        todo = Todo(content = content)
        todo.save()
    # Show all the list again
    todos = Todo.objects.order_by('-time')
    return render_template("index.html", todos = todos, form = form)
예제 #6
0
파일: views.py 프로젝트: cytues/Todo
def add():
    # request传入表单数据
    form = TodoForm(request.form)
    # 表单验证
    if form.validate():
        # 将表单内容传入
        content = form.content.data
        todo = Todo(content = content, time = datetime.now())
        # 保存todo表单
        todo.save()
    todos = Todo.objects.order_by('-time')
    return render_template('index.html', todos=todos, form=form)
예제 #7
0
파일: views.py 프로젝트: ttop5/Todo
def add():
    # print(request.form)
    form = TodoForm(request.form)
    # print form.__dict__
    if form.validate():
        content = form.content.data
        todo = Todo(content=content, time=datetime.now())
        # todo = Todo()
        # todo.content = content
        todo.save()
    todos = Todo.objects.order_by("-time")
    return render_template("index.html", todos=todos, form=form)
예제 #8
0
def undone(todo_id):
    form = TodoForm()
    todo = Todo.objects.get_or_404(id=todo_id)
    todo.status = 0
    todo.save()
    todos = Todo.objects.order_by('-time')
    return render_template("index.html", todos=todos, form=form)
예제 #9
0
def index():
    form = TodoForm()
    todos = Todo.objects.order_by('-time')
    return render_template("index.html",
                           todos=todos,
                           form=form,
                           version=app_version())
예제 #10
0
def delete(todo_id):
    form = TodoForm()
    todo = Todo.objects.get_or_404(id=todo_id)
    todo.delete()
    todos = Todo.objects.order_by('-time')
    return render_template("index.html",
                           todos=todos,
                           form=form,
                           version=app_version())
예제 #11
0
def done(todo_id):
    form = TodoForm()
    todo = Todo.objects.get_or_404(id=todo_id)
    todo.status = 1
    todo.save()
    todos = Todo.objects.order_by('-time')
    return render_template("index.html",
                           todos=todos,
                           form=form,
                           version=app_version(),
                           hostname=hostname())
예제 #12
0
def index():
    form = TodoForm()
    todos = Todo.objects.order_by('+time')
    return render_template("index.html", todos=todos, form=form)
예제 #13
0
파일: views.py 프로젝트: hawk2020/todo
def delete(todo_id):
    form = TodoForm()
    todo = Todo.objects.get_or_404(id=todo_id)
    todo.delete()
    todos = Todo.objects.order_by('-time')
    return render_template('index.html',todos=todos,form=form)