def make_controller(cls, config, session, left_menu_items=None):
        """New CRUD controllers using the admin configuration can be created using this."""
        m = config.model
        Controller = config.defaultCrudRestController

        class ModelController(Controller):
            model        = m
            table        = config.table_type(session)
            table_filler = config.table_filler_type(session)
            new_form     = config.new_form_type(session)
            new_filler   = config.new_filler_type(session)
            edit_form    = config.edit_form_type(session)
            edit_filler  = config.edit_filler_type(session)
            allow_only   = config.allow_only

            if hasattr(config.layout, 'crud_resources'):
                resources = config.layout.crud_resources

            def _before(self, *args, **kw):
                super(self.__class__, self)._before(*args, **kw)

                tmpl_context.make_pager_args = make_pager_args

                if request.response_type not in ('application/json',):
                    default_renderer = AdminController._get_default_renderer()
                    for action in ('get_all', 'new', 'edit'):
                        for template in config.layout.crud_templates.get(action, []):
                            if template.startswith(default_renderer):
                                override_template(getattr(self, action), template)

        return ModelController(session, left_menu_items)
def make_controller ( cls , config , session , left_menu_items = None ) : m = config . model Controller = config . defaultCrudRestController class ModelController ( Controller ) : model = m table = config . table_type ( session ) table_filler = config . table_filler_type ( session ) new_form = config . new_form_type ( session ) new_filler = config . new_filler_type ( session ) edit_form = config . edit_form_type ( session ) edit_filler = config . edit_filler_type ( session ) allow_only = config . allow_only if hasattr ( config . layout , 'crud_resources' ) : resources = config . layout . crud_resources def _before ( self , * args , ** kw ) : super ( self . __class__ , self ) . _before ( * args , ** kw ) tmpl_context . make_pager_args = make_pager_args if request . response_type not in ( 'application/json' , ) : default_renderer = AdminController . _get_default_renderer ( ) for action in ( 'get_all' , 'new' , 'edit' ) : for template in config . layout . crud_templates . get ( action , [ ] ) : if template . startswith ( default_renderer ) : override_template ( getattr ( self , action ) , template ) return ModelController ( session , left_menu_items )
New CRUD controllers using the admin configuration can be created using this.