how to read django data in javascript from Built-in template tags

2016-09-23 Thread Nazib Ahmad
in my program javascript dont read the data which is got from django but the same page html tag the the data. here is my code var bubbleChartData = { datasets: [ { label: "Graph of Attacks", backgroundColor:"#FF6384",

Re: Django data to Javascript

2013-10-22 Thread drakko
Thanks!!! This helped a lot. Now it is working as I was hoping :) drakko trešdiena, 2013. gada 16. oktobris 16:14:39 UTC+2, ke1g rakstīja: > > > On Wed, Oct 16, 2013 at 3:39 AM, drakko >wrote: > >> ... >> > > >> But accessing should_have_found_list in template has no

Re: Django data to Javascript

2013-10-16 Thread Bill Freeman
On Wed, Oct 16, 2013 at 3:39 AM, drakko wrote: > ... > > But accessing should_have_found_list in template has no problems. I have > separate JS file that contains functions (event handlers for buttons etc.). > I can't figure out (total newbie in JS :D ) how to access (or

Re: Django data to Javascript

2013-10-16 Thread drakko
Thanks for help. I will try some of these ideas :) I don't understand why you are JSON encoding form.field_mapping for the > fields template variable. > This was like that when I got this code. I am just continuing to develop this app. But accessing should_have_found_list in template has no

Re: Django data to Javascript

2013-10-15 Thread Larry Martell
On Tue, Oct 15, 2013 at 9:54 AM, Scot Hacker wrote: > > > On Tuesday, October 15, 2013 8:45:09 AM UTC-7, larry@gmail.com wrote: >> >> >>> >> You can embed js anywhere in your template, e.g.: >> >> {% for shbf in should_have_found_list %} >> >>

Re: Django data to Javascript

2013-10-15 Thread Bill Freeman
I'd probably put the script tag outside the for loop. But I don't see where you're passing should_have_found_list to the context. If it's an item (top level) in form.field_mapping, then it needs to be something like: ... {% for shbr in form.field_mapping.should_have_found_list %} ... I

Re: Django data to Javascript

2013-10-15 Thread Scot Hacker
On Tuesday, October 15, 2013 8:45:09 AM UTC-7, larry@gmail.com wrote: > > >> > You can embed js anywhere in your template, e.g.: > > {% for shbf in should_have_found_list %} > > my_js_function(shbf); > > {% endfor %} > I think you meant to write:

Re: Django data to Javascript

2013-10-15 Thread Larry Martell
On Tue, Oct 15, 2013 at 6:46 AM, drakko wrote: > Hello! > > I'm new to Django and Javascript and so I need some help with passing list > from django template to Javascript. > > The list is available in template (template.html) by using > > {% for shbf in

Django data to Javascript

2013-10-15 Thread drakko
Hello! I'm new to Django and Javascript and so I need some help with passing list from django template to Javascript. The list is available in template (template.html) by using {% for shbf in should_have_found_list %} but I have no idea how to access this list from Javascript. The