Re: storing django object into javascript array

2011-06-14 Thread jay K.
Hello, I was given the following solution for storing a django object in a javascript variable //SOLUTION BEGINS HERE 1. Use a loop in the template: var map_schools = [{% for school in city.school_set.all %}"{{ school|escapejs }}"{% if not forloop.last %},{% endif %}{% endfor %}]; You'll notice

Re: storing django object into javascript array

2011-06-10 Thread Ian Clelland
On Fri, Jun 10, 2011 at 7:48 AM, jay K. wrote: > > Hello, > > I am not a django developer, but I have a background on html, css, > javascript, jquery and php. > > I was wondering if you can help me with a question regarding django, > since I'm working on a website built on django (which was not s

Re: storing django object into javascript array

2011-06-10 Thread Brice Leroy
Hello Jay, When you call city.school_set.all ,you get an array of object. the template render the string representation of the object. You might want to loop other them. Check the json serializer too : https://docs.djangoproject.com/en/dev/topics/serialization/#serialization-formats Brice 2011

storing django object into javascript array

2011-06-10 Thread jay K.
Hello, I am not a django developer, but I have a background on html, css, javascript, jquery and php. I was wondering if you can help me with a question regarding django, since I'm working on a website built on django (which was not started by me) I want to store a django object into a javascri