Can web2py do template inheritance like Django?

[edit|delete]

No, because template inhertitance is not a well defined concepts and eventually causes problems. Web2py can do this:

layout.html

<html><body>
{{include}} <!-- must come before the two blocks below -->
whatever html
{{sidebar()}}
whatever html
{{maincontent()}}
whatever html
</body></html>

myview.html

{{extend 'layout.html'}}
{{def sidebar():}}
<h1>This is the sidebar</h1>
{{return}}
{{def maincontent():}}
<h1>This is the maincontent</h1>
{{return}}


Post a comment