Beispiel #1
0
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)
Beispiel #2
0
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)
Beispiel #3
0
 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]
     )