def POST(self): form = model_form() if not form.validates(): templates = get_templates() req = web.ctx.req req.update({ 'form': form, 'templates': templates, 'fields': [], 'relations': [], }) return render.model_edit(**req) save_model(-1, form.d) raise web.seeother('/model/index')
def POST(self, id): form = model_form() if not form.validates(): templates = get_templates() fields = get_fields(id) relations = get_relations(id) req = web.ctx.req req.update({ 'mid': id, 'form': form, 'templates': templates, 'fields': fields, 'relations': relations, }) return render.model_edit(**req) save_model(int(id), form.d) raise web.seeother('/model/index')