Hi all,
I am trying to display the value from the context_process.py file to the template.
The content of my context_process.py is as follows:
from fusioncharts.models import QRC_DB
from django.db import connection
def get_result(request):
cursor = connection.cursor()
pattern = "%%"+TotalTime+"%%"
cursor.execute("select * from fusioncharts_qrc_db")
rows = cursor.fetchall()
return {'get_result': rows}
Then in the html template file, I am trying to display the variable get_result as follows:
{% block content %}
<h3> Result = </h3>
<br>
{{get_result}}
{% endblock %}
My template details in the settings.py is as follows:
TEMPLATES = [
{
.......
'OPTIONS': {
'context_processors': [
.........
'fusioncharts.context_processors.get_result',
],
},
},
]
My views.py file is as follows:
def home(request):
context = RequestContext(request)
response_context = {}
return render(request, 'display_data.html',response_context)
But when I am running that, it is not displaying anything in the web page.
Is there anything missing in my code? What is going wrong here?