Ejemplo n.º 1
0
 def GET(self):
     form = relation_form()
     data = web.input()
     mid = data.mid
     models = get_active_models()
     req = web.ctx.req
     req.update({
         'models': models,
         'form': form,
         'mid': mid,
         })
     return render.relation_edit(**req)
Ejemplo n.º 2
0
 def GET(self):
     req = web.ctx.req
     models = get_active_models()
     data = web.input(p=1)
     pagination = Pagination(Entity, data.p)
     entities = pagination.queryset
     req.update({
         'entities': entities,
         'models': models,
         'pagination': pagination,
         })
     return render.entity_index(**req)
Ejemplo n.º 3
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.º 4
0
 def GET(self, id):
     form = relation_form()
     relation = get_relation(id)
     form.fill(relation)
     data = web.input()
     models = get_active_models()
     mid = data.mid
     model = get_model(mid)
     req = web.ctx.req
     req.update({
         'models': models,
         'form': form,
         'mid': mid,
         'mtitle': model.title,
         })
     return render.relation_edit(**req)
Ejemplo n.º 5
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)