Ejemplo n.º 1
0
 def POST(self, id):
     form = relation_form()
     data = web.input()
     mid = data.mid
     if not form.validates():
         models = get_active_models()
         req = web.ctx.req
         req.update({
             'form': form,
             'models': models,
             'mid': mid,
             })
         return render.relation_edit(**req)
     save_relation(int(id), form.d)
     raise web.seeother('/model/%s/edit' % mid)
Ejemplo n.º 2
0
 def POST(self):
     form = relation_form()
     data = web.input()
     mid = data.mid
     if not form.validates():
         model = get_model(mid)
         models = get_active_models()
         req = web.ctx.req
         req.update({
             'models': models,
             'form': form,
             'mid': mid,
             'mtitle': model.title,
             })
         return render.relation_edit(**req)
     form_data = form.d
     form_data.model_id = mid
     save_relation(-1, form_data)
     raise web.seeother('/model/%s/edit' % mid)