hello everybody,
i like to display database records in sidebar of every page.
i define the function that fetch the records and return as dictionary.
then i put the function in default.py and return the result of the
function every view function, it works fine.
such as,
def some_function():
''fetch database records''
return rows
def index():
rows = some_function()
return dict(rows=rows)
in layout.html:
{{for row in rows:}}
<li>{{=row}}</li>
{{pass}}
But this approach is awkward. i like to hide sidebar rendering from
main page rendering.
There should be more beautiful approach in web2py.
Is there any ideas?
Thank you in advance.