Hello everyone,
There are some codes in between, but I wanted to show the specific line below. I’m sending the project_list data to base.html with render (without json).
I can get the id values when I write {{ item.id }} but when I write {{ item.name }} I get the error *
“Query.Deferred exception: Madrid is not defined”
Note: project_list contains Barcelona(id=1) and Madrid(id=2) data.
Do you have any idea why that error occurs and how to get other info like name, address, email etc. ? Thank in advance.
views.py
project_list = Projects.objects.all().order_by('name').values('id', 'name')
..........
return render(request, 'base.html', {'project_list':project_list, 'form': form})
base.html
<script>
{% for item in project_list %}
log.console({{ item.id }})
{% endfor %}
</script>