Example #1
0
 def dispatch_request(self, name):
     setting = Setting.query.get(name)
     form = EditForm(request.form, setting)
     if request.method == 'POST' and form.validate():
         form.populate_obj(setting)
         session.commit()
         return redirect(url_for('settings.list'))
     return render_template('settings/edit.html', form=form, setting=setting)
Example #2
0
 def dispatch_request(self):
     settings = Setting.query.filter(Setting.name != 'otpsecret').all()
     form = EditForm(request.form)
     if request.method == 'POST' and form.validate():
         setting = Setting(form.name.data, form.value_decrypted.data)
         session.add(setting)
         session.commit()
         return redirect(url_for('settings.list'))
     return render_template('settings/list.html', settings=settings,
                            form=form)