tags:

views:

80

answers:

1

Hi, I want to place the project hierarchy in this way

project
 |-app
 |   \app1
 |      |-templates
 |          \app1_templ.html
 |      |- views.py
 |      \-models.py
 |-templates
 |    \main.html
 |-views.py
 |-models.py
 ...

But in the main.html i want to use `{%include app1_templ.html%}. Assuming the views.py from the app1:

def main(request):
  info= Informations.objects.all() 
  return render_to_response('main.html', {'a':info})

and the app1_templ.html

   {% for b in a %}
       <li> title:{{ b.title }}</li>
    {%empty %}
       EMPTY
    {% endfor %}

I have put in settings.py the TEMPLATE_DIRS an extra folder info

os.path.join(os.path.dirname(__file__), 'apps/app1/app1_templ').replace('\\','/'), 

Rendering the page always seems to give EMPTY no matter what.

Why the a list seems to be empty?

A: 

Try passing in the context_instance:

return render_to_response('main.html', {'a': info}, context_instance=RequestContext(request))
godswearhats
I have modyfied the views.py form the main project replacing the previous call to render_to_response and importing the from django.template import RequestContext but the result is still the same.
It was worth a try :-)
godswearhats
well i did tried but unfortunatelly didn't work. Is there really no soulution 4 this problem?