--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
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 javascript array. So far I have
this code:
In my template file:
<script type="text/javascript" language="javascript" charset="utf-8">
var map_schools = {{ city.school_set.all }};
</script>
Unfortunately the django object is not stored as desired, but instead
it gets stored like the following:
var map_schools = [<School: Oxford, Eckersley>]
<script type="text/javascript">
....
var city_schools = [{% for school in city.school_set.all %}
{ "school" : "{{ school.name }}",
"latitude" : "{{ school.map_latitude }}",
"longitude" : "{{ school.map_longitude }}"
},
{% endfor %}
]
....
</script>
John