def settings(): user = g.user form = SettingsForm(obj=user) next_url = request.args.get('next', url_for('.settings')) if form.validate_on_submit(): form.save() return redirect(next_url) return render_template('account/settings.html', form=form)
def put(self, id): user = Account.query.get_or_404(id) if g.user != user: return abort(403) form = SettingsForm(obj=user) if form.validate_on_submit(): form.save() return jsonify( msg="Settins updated" ) return jsonify( error=form.errors.values()[0] )