Hi, I started with web2py a few weeks ago, writing some very simple apps. I noticed that I was constantly repeating myself in the following steps : Write a controller to fetch the data Write a view to present data.
So, I made generic controllers and views, which I later call using this schema : User request : http://myserver/myapp/mymodel_list In CONTROLLERS/DEFAULT.PY : def mymodel_list(): return generic_list() In MODELS/GENERIC.PY : def generic_list(): # Do all work here, get mydata, pagination, etc... return dict(mydata) In VIEWS/DEFAULT/MYMODEL_LIST.HTML : {{extend 'generic_list.html'}} In VIEWS/GENERIC_LIST.HTML {{extend 'layout.html'}} {{include}} <!-- Do all representation of mydata --> This works well for me, cause I only have to deal with 4/5 controller and views (generic_list, generic_read, generic_add, generic_edit). One question though : For every model I have to create all the functions : def mymodel_read(): return generic_read() def mymodel_list(): return generic_list() etc... .. and I also have to create all the views : mymodel_list.html : {{extend 'generic_list'}} mymodel_list.read : {{extend 'generic_read'}} ...etc I believe there must be a way to avoid creating these views and these controllers, through the use of routes, or something. Someone care to guide me to do this ? --

