def new_item():
if request.GET.get('save','').strip(): #?????
new=request.GET.get('task','').strip()
conn=sqlite3.connect('todo.db')
c=conn.cursor()
c.execute('INSERT INTO todo (task,status) VALUES (?,?)',(new,1))
new_id=c.lastrowid
conn.commit()
c.close()
return "<p> the new task was inserted into the database,the id is %s</p>" % new_id
else:
return template('new_task.html')
评论列表
文章目录