I am working on a project in django 1.5.12. version with django-cms installed . I have a file generated by command "pip freeze > frozen.txt" where is next information with what I have installed:
Django==1.5.12
MySQL-python==1.2.5
South==1.0.2
argparse==1.2.1
distribute==0.6.24
django-classy-tags==0.6.2
django-cms==2.4.3
django-mptt==0.5.2
django-sekizai==0.8.2
html5lib==1.0b7
six==1.9.0
wsgiref==0.1.2
Well, my problem is that I have an app in my project where I have next code in views.py:
from django.shortcuts import *
def test(request):
data = {'test 1': [ [1, 10] ], 'test 2': [ [1, 10] ],'test 3':[ [2,20]] }
print data # to see if function works
return render_to_response("project_pages.html",{'data':data},context)
And in my template project_pages.html I have this :
<table>
<tr>
<td>field 1</td>
<td>field 2</td>
<td>field 3</td>
</tr>
{% for author, values in data.items %}
<tr>
<td>{{author}}</td>
{% for v in values.0 %}
<td>{{v}}</td>
{% endfor %}
</tr>
{% endfor %}
</table>
and isn't render the response to the template. And in terminal doesn't show me any errors. The function is working because it is printing data.
If try to return something like this:
return render_to_response("project_pages.html",{'data':data})
without context at the end (it is different call) it gives me next error:
"You must enable the 'sekizai.context_processors.sekizai' template "
TemplateSyntaxError: You must enable the 'sekizai.context_processors.sekizai' template context processor or use 'sekizai.context.SekizaiContext' to render your templates.
In my settings.py I have sekizai:
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.i18n',
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.core.context_processors.static',
'cms.context_processors.media',
'sekizai.context_processors.sekizai',
'sekizai.context.SekizaiContext',
)
So, what should I do?
Review what context variable have. It should have something like that:
Example:
from django.template import RequestContext
def view(request):
...
return render_to_response(
"project_pages.html",
{'data':data},
context_instance=RequestContext(request),
)