def checkattribute_edit(checktype_id, id = None): form = getFormForModel(AttributeForm, CheckAttribute, id) if request.method == 'POST' and form.validate(): attr = CheckAttribute().save(id = id, id_check_type = checktype_id, name = form.name.data, type = form.type.data, required = form.required.data) if attr: return redirect(url_for('.checktype_edit', id = checktype_id)) return render_template('edit.html', form = form)
def users_edit(id = None): form = getFormForModel(UserForm, Users, id) if request.method == 'POST' and form.validate(): user = dict(id = id, name = form.name.data, email = form.email.data) if form.password.data: user['password'] = form.password.data item = Users().save(**user) if item: return redirect(url_for('.users_edit', id = item)) return render_template('edit.html', form = form)
def checkattribute_edit(checktype_id, id=None): form = getFormForModel(AttributeForm, CheckAttribute, id) if request.method == 'POST' and form.validate(): attr = CheckAttribute().save(id=id, id_check_type=checktype_id, name=form.name.data, type=form.type.data, required=form.required.data) if attr: return redirect(url_for('.checktype_edit', id=checktype_id)) return render_template('edit.html', form=form)
def checktype_edit(id = None): form = getFormForModel(CheckForm, CheckType, id) if request.method == 'POST' and form.validate(): check = CheckType().save(id = id, name = form.name.data) if check: return redirect(url_for('.checktype_edit', id = check)) if id: attrs = CheckAttribute().getAll(checktype_id = id) else: attrs = list() return render_template('checktype/edit.html', form = form, attrs = attrs, id = id)
def checktype_edit(id=None): form = getFormForModel(CheckForm, CheckType, id) if request.method == 'POST' and form.validate(): check = CheckType().save(id=id, name=form.name.data) if check: return redirect(url_for('.checktype_edit', id=check)) if id: attrs = CheckAttribute().getAll(checktype_id=id) else: attrs = list() return render_template('checktype/edit.html', form=form, attrs=attrs, id=id)