Пример #1
0
def change_avatar2():
    upload_form = UploadAvatarForm()
    crop_form = CropAvatarForm()
    return render_template('user/settings/change_avatar.html',
                           upload_form=upload_form,
                           crop_form=crop_form,
                           sequence=2)
Пример #2
0
def change_avatar():
	"""
	修改头像
	"""
	logger.info('url = ' + str(request.url))
	upload_form = UploadAvatarForm()
	crop_form = CropAvatarForm()
	return render_template('user/settings/change_avatar.html', upload_form=upload_form, crop_form=crop_form)
Пример #3
0
def upload_avatar():
    form = UploadAvatarForm()
    if form.validate_on_submit():
        image = form.image.data
        filename = avatars.save_avatar(image)
        current_user.avatar_raw = filename
        db.session.commit()
        flash('Image uploaded, please crop.', 'success')
    flash_errors(form)
    return redirect(url_for('.change_avatar'))
Пример #4
0
def upload_avatar():
    form = UploadAvatarForm()
    if form.validate_on_submit():
        image = form.image.data
        filename = avatars.save_avatar(image)  # 保存头像,并取得文件名
        current_user.avatar_raw = filename
        db.session.commit()
        flash('文件已上传。', 'info')
    flash_errors(form)
    return redirect(url_for('.change_avatar'))
Пример #5
0
def change_avatar():
    upload_form = UploadAvatarForm()
    crop_form = CropAvatarForm()
    has_temp = False
    if request.args.get('has_temp') == 'true':
        has_temp = True
    return render_template('user/settings/change_avatar.html',
                           upload_form=upload_form,
                           crop_form=crop_form,
                           has_temp=has_temp)
Пример #6
0
def upload_avatar():
	"""
	更新头像
	"""
	logger.info('url = ' + str(request.url))
	form = UploadAvatarForm()
	if form.validate_on_submit():
		image = form.image.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'))
Пример #7
0
def change_avatar():
    upload_form = UploadAvatarForm()
    crop_form = CropAvatarForm()
    return render_template("user/settings/change_avatar.html",
                           upload_form=upload_form,
                           crop_form=crop_form)