Pass data to javascript from

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 {{ }} but when I write {{ }} 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.

project_list = Projects.objects.all().order_by('name').values('id', 'name')
return render(request, 'base.html', {'project_list':project_list, 'form': form})


{% for item in project_list %}
   log.console({{ }})
{% endfor %}

Please post the Projects model that you are trying to render. (We may end up needing to see the complete view and template, but probably not yet.)

Here is the Projects model. Email, address data is not in Projects model, but if I can make that work, I ll be able to apply all other models.

class Projects(models.Model):

    name = models.CharField(max_length=128, unique=True)
    prefix = models.CharField(max_length=256)
    description = models.CharField(max_length=256, blank=True)

    def __str__(self):

Just in case anybody interested in, I found the solution…
editableP = serializers.serialize("json", Projects.objects.all())

var eProject = JSON.parse('{{ editableP | safe }}')