merge-requests/3/head
bug_creator 3 years ago
parent a9afa1028d
commit c13c8683d9

@ -508,13 +508,16 @@ def edit_profile():
return render_template('edit_profile.html', form=form) return render_template('edit_profile.html', form=form)
if request.method == 'POST': if request.method == 'POST':
# 读取前端数据 # 读取前端数据
main_image_file = form.main_image_file.data try:
print(main_image_file) main_image_file = form.main_image_file.data
main_image_url = "" print(main_image_file)
if main_image_file.filename != "": main_image_url = ""
filename = str(os.urandom(30).hex()) + "." + main_image_file.filename.split(".")[-1] if main_image_file.filename != "":
main_image_file.save(os.path.join(current_app.static_folder, 'assets', filename)) filename = str(os.urandom(30).hex()) + "." + main_image_file.filename.split(".")[-1]
main_image_url = filename main_image_file.save(os.path.join(current_app.static_folder, 'assets', filename))
main_image_url = filename
except:
pass
username_find = User.query.filter_by(username=request.form["username"]).first() username_find = User.query.filter_by(username=request.form["username"]).first()
if username_find is not None and username_find != current_user: if username_find is not None and username_find != current_user:
flash("Your new username already exists, please change your username") flash("Your new username already exists, please change your username")

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

Binary file not shown.
Loading…
Cancel
Save