Exemplo n.º 1
0
Arquivo: model.py Projeto: F9O/govsite
 def GET(self):
     form = model_form()
     templates = get_templates()
     req = web.ctx.req
     req.update({
         'form': form,
         'templates': templates,
         'fields': [],
         'relations': [],
         })
     return render.model_edit(**req)
Exemplo n.º 2
0
Arquivo: model.py Projeto: F9O/govsite
 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')
Exemplo n.º 3
0
 def GET(self, id):
     templates = get_templates()
     form = model_form()
     model = get_model(id)
     fields = get_fields(id)
     relations = get_relations(id)
     form.fill(model)
     req = web.ctx.req
     req.update({
         'mid': id,
         'form': form,
         'templates': templates,
         'fields': fields,
         'relations': relations,
         })
     return render.model_edit(**req)
Exemplo n.º 4
0
Arquivo: model.py Projeto: F9O/govsite
 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')