Can you change the view being used by web2py in the controller? Ideally I'd be interested in doing something like:
response.view = 'NewViewName'
You've got it exactly, though be sure to include the relative path to the view within the /views folder. So, if you have /views/default/other_view.html, you can do:
response.view = 'default/other_view.html'
You can also directly render any view:
def myfunc():
context = dict(...)
return response.render('default/other_view.html', context)
See here and here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With