need help figuring out dynamic menu generation in django
Posted
by photographer
on Stack Overflow
See other posts from Stack Overflow
or by photographer
Published on 2010-03-25T00:31:10Z
Indexed on
2010/03/25
0:33 UTC
Read the original article
Hit count: 473
I need to dynamically generate a code like this in the resulting html:
<p>>> gallery one</p>
<p><a href="../gallery2">gallery two</a></p>
<p><a href="../about">about the author</a></p>
<p><a href="../news">our news</a></p>
I do have menu_code string variable created in views.py (it is generated depending on an item number of the current page passed — 1 in the case above), which contains that long string with the code shown above. It is (well, supposed to) passed by locals() into the html template (all other variables are passed that way successfully):
return render_to_response('gallery_page.html', locals())
I have this:
{% include menu_code %}
inside the template html. But instead of being interpreted as code it is just shown as text in the browser.
What am I doing wrong? How to make it work as a dynamically generated menu?
© Stack Overflow or respective owner