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?