def edit(self, sid): server = ServiceSettings.objects(id=sid).first() form = ServiceSettingsForm(obj=server) if request.method == 'POST' and form.validate_on_submit(): server = form.update_entry(server) server.save() return jsonify(status='ok'), 200 return render_template('service/edit.html', form=form)
def add(self): form = ServiceSettingsForm(obj=ServiceSettings()) if request.method == 'POST' and form.validate_on_submit(): new_entry = form.make_entry() admin = UserPair(current_user.id, constants.Roles.ADMIN) new_entry.add_provider(admin) current_user.add_server(new_entry) return jsonify(status='ok'), 200 return render_template('service/add.html', form=form)