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:
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?
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/aa0a33a7-3cb8-4cc5-9ccb-c95cddd83c67%40googlegroups.com.
No comments:
Post a Comment