def upload_avatar(): form = UploadAvatarForm() if form.validate_on_submit(): image = form.upload.data filename = avatars.save_avatar(image) current_user.avatar_raw = filename db.session.commit() flash('图片已上传,请剪切图片。', 'success') flash_errors(form) return redirect(url_for('.change_avatar'))
def change_avatar(): upload_form = UploadAvatarForm() crop_form = CropAvatarForm() return render_template('user/setting/change_avatar.html', upload_form=upload_form, crop_form=crop_form)