Пример #1
0
    def GET(self, id):
        field = get_field(id)
        form = FIELD_FORM_TYPE[field.type+'_form']()
        form.fill(field)
        if field.props:
            prop_dict = eval(field.props)
            if field.type == 'text':
                form.lines.set_value(prop_dict['lines'])
                form.editor.set_value(prop_dict['editor'])
            elif field.type == 'select' or field.type == 'radio' or field.type == 'checkbox':
                form.options.set_value(prop_dict['options'])
                if field.type == 'select':
                    form.is_multisel.set_value(prop_dict['is_multisel'])

        data = web.input()
        mid = data.mid
        model = get_model(mid)
        req = web.ctx.req
        req.update({
            'type': field.type,
            field.type+'_form': form,
            'mid': mid,
            'mtitle': model.title,
            })
        return render.field_edit(**req)
Пример #2
0
 def GET(self, id):
     form = field_form()
     field = get_field(id)
     form.fill(field)
     data = web.input()
     mid = data.mid
     req = web.ctx.req
     req.update({
         'form': form,
         'mid': mid,
         })
     return render.field_edit(**req)