Hi All,
I am very new to django framework ( just 2 days)
I am referring django tutorial pdf for my self learning.
Right now I am stuck at my very first program using Django Template Language (DTL) .
Please find the below code just for your reference:
urls.py ( Application )
---------
from django.urls import path
from . import views
urlpatterns = [
path('dispWelcomePage/', views.myWelcomepage, name='myWelcomepage'),
path('secondPage/', views.mySecondpage),
path('pagenum/', views.dispInputParam),
path('exRender/',views.exampleRenderFunc),
path('exRenderDict/',views.passDictValues)
]
views.py ( Application )
----------
from django.shortcuts import render
from django.http import HttpResponse
def passDictValues(request):
mylist=['a','b','c','d']
empDetails={'name':'ABCD','city':'xyz','age':'30','gender':'M','MyListArg':mylist}
return render(request,'myapp/RenderDictParams.html',empDetails)
RenderDictParams.html:
--------------------------------
<html>
<body>
<h3>This is Render Method Example with Python Dictionary as Arguments!! </h3>
Testing_1<br>
{% for val in mylist %}
{{ val }}
{% endfor %}
Testing_2
</body>
</html>
When running the url
http://127.0.0.1:8000/myapp/exRenderDict/ output doesn't display the values which is from the for loop.
(Please find the attached file just for you reference )
My django verion : 2.0.1
Python version : 3.6.0
Please you help me if possible to sort out this.
Let me know if I am missing anything or any further details needed.
Thanks for your support
Regards
JayaramN