显示题目时同时显示过往的备注
This commit is contained in:
parent
b17f89c466
commit
55d90e48a8
|
|
@ -23,6 +23,9 @@
|
|||
</select><br><br>
|
||||
<input type="submit" value="提交备注">
|
||||
</form>
|
||||
<br>
|
||||
<h1>过往备注</h1>
|
||||
{{ old_remarks|safe }}
|
||||
<h1>题目内容</h1>
|
||||
<img src="{{ image_path }}" alt="Question Image">
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@ def show_image():
|
|||
val = (id,)
|
||||
mycursor.execute(sql,val)
|
||||
content = mycursor.fetchall()[0][0]
|
||||
sql = "SELECT date,remark_content FROM remarks WHERE ID = %s;"
|
||||
mycursor.execute(sql,val)
|
||||
remark_list = sorted(mycursor.fetchall(),key=lambda item:item[0],reverse=True)
|
||||
print(remark_list)
|
||||
mydb.close()
|
||||
content_hash = hashlib.sha256(content.encode("utf8")).hexdigest()
|
||||
# print(content_hash,type(content_hash))
|
||||
|
|
@ -45,7 +49,11 @@ def show_image():
|
|||
mycursor.execute("INSERT INTO pics (ID,pic,date,hash) VALUES (%s,%s,%s,%s)",(id,image_data,currentdate,content_hash))
|
||||
mydb.commit()
|
||||
mydb.close()
|
||||
return render_template('show_image.html', image_path=f'/static/{id}.png')
|
||||
output_string = ""
|
||||
for rem in remark_list:
|
||||
output_string += f"{rem[0]} {rem[1]}\n"
|
||||
output_string = re.sub(r"\n","<br><br>\n",output_string) + "<br>\n"
|
||||
return render_template('show_image.html', image_path=f'/static/{id}.png', old_remarks = output_string)
|
||||
|
||||
|
||||
@app.route('/submit_remarks', methods=['POST'])
|
||||
|
|
|
|||
Reference in New Issue