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/6/10 jay K. <jay.developer2...@gmail.com>

>
> 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 = [&lt;School: Oxford, Eckersley&gt;]
>
> I am unable to work with the javascript array. Right now this piece of
> code is commented out because enabling it prevents the rest of the js
> code from running properly
>
> Any suggestions are welcome
>
> Thanks,
>
> Regards,
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
blog: http://www.debrice.com
Time tracking tool: http://alpha.kaaloo.com
Django site generator: http://alpha.djangogenerator.com
linkedin: http://www.linkedin.com/in/bricepleroy

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to