Exemplo n.º 1
0
def edit():
	form = UpdateAccountForm()

	if form.validate_on_submit():
		current_user.location 	 = escape(form.location.data)
		current_user.description = escape(form.description.data)
		db.session.add(current_user._get_current_object())
		db.session.commit()
		flash("Your account has been updated.", "success")
		return redirect(url_for("account.show", username=current_user.username))

	form.location.data 	  = unescape(current_user.location)
	form.description.data = unescape(current_user.description)
	return render_template("edit_account.html", form=form)
def delete():
    db.session.delete(current_user._get_current_object())
    db.session.commit()
    logout_user()
    flash("Your account has been deleted.", "success")
    return redirect(url_for("main.home"))