4
4
<html lang="zh-cn">
5
5
<head>
6
6
<meta charset="utf-8">
7
- <style type="text/css">
8
- h1
9
- {
10
- color: green;
11
- }
12
- table, th, td
13
- {
14
- border: 1px solid blue;
15
- }
16
- table
17
- {
18
- border-collapse: collapse;
19
- width: 100%;
20
- }
21
- th
22
- {
23
- height: 50px;
24
- }
25
- td.task
26
- {
27
- width: 70%;
28
- }
29
- input#delete
30
- {
31
- font-size: 15px;
32
- color: blue;
33
- background-color: #FFFFFF;
34
- border-width: 0;
35
- cursor: pointer;
36
- }
37
- textarea
38
- {
39
- vertical-align: middle;
40
- width: 500px;
41
- height: 100px;
42
- }
43
- input#submit
44
- {
45
- width: 107px;
46
- height: 42px;
47
- border-width: 0;
48
- font-size: 17px;
49
- font-weight: 500;
50
- border-radius: 6px;
51
- cursor: pointer;
52
- }
53
- </style>
7
+ <link type="text/css" rel="stylesheet" href="./static/css.css" />
54
8
</head>
55
9
56
10
<body>
63
17
<td class="task_h"><div align="center">任务</div></td>
64
18
<td class="manage_h"><div align="center">管理</div></td>
65
19
</tr>
66
- <tr>
67
- <td class="task">{{ task.task }}</td>
68
- <td class="manage">
69
- <div align="center">
70
- <input type="submit" name="id-1" id="delete" value="删除" />
71
- </div></td>
72
- </tr>
73
- <tr>
74
- <td class="task">{{ task.task }}</td>
75
- <td class="manage">
76
- <div align="center">
77
- <input type="submit" name="id-2" id="delete" value="删除" />
78
- </div></td>
79
- </tr>
20
+
21
+ {0}
80
22
</table>
81
23
<br>
82
24
<textarea name="newtask" id="newtask" maxlength="500"></textarea>
96
38
97
39
@route ('/todo' )
98
40
def index ():
99
- return const
41
+ return const . format ( SQLIO . PageMake (),)
100
42
@post ('/todo' )
101
43
def Accept ():
102
44
Req = request .body .read ()
@@ -107,17 +49,23 @@ def Accept():
107
49
M [A [0 ]] = urllib .unquote (A [1 ])
108
50
for j in M .keys ():
109
51
if re .findall ("id-" ,j ):
110
- return "Delete" ,j [3 :]
52
+ SQLIO .SQL_del (int (j [3 :]))
53
+ redirect ('/todo' , 302 )
111
54
try :
112
55
type = M ["new" ]
113
56
newtask = M ["newtask" ]
114
- if newtask != "" :
115
- return newtask
116
- else :
117
- return "=.=所以你想添加什么任务呀"
118
57
except :
119
- return "虽然不知道你在干什么但是触发了服务器错误呢"
58
+ redirect ('/error' , 404 )
59
+ if newtask != "" :
60
+ SQLIO .SQL_in (newtask )
61
+ redirect ('/todo' , 302 )
62
+ else :
63
+ return "=.=所以你想添加什么任务呀"
64
+
120
65
@route ('/error' )
121
66
def err ():
122
67
return "虽然不知道你在干什么但是触发了服务器错误呢"
68
+ @route ('/static/<filename>' )
69
+ def server_static (filename ):
70
+ return static_file (filename , root = Root )
123
71
run (host = 'localhost' ,port = 8080 )
0 commit comments