Re: Passing parameters / attributes to javascript in a template

2015-08-05 Thread Déborah Leder
Thank you for your answers, everyone. Alex, indeed I didn't know about the forloop last trick. It worked like a charm ! And Daniel, for some reasons I prefer not to mess with the views for now, but when if I need to clean up my code, I keep your answer in mind. -- You received this message beca

Re: Passing parameters / attributes to javascript in a template

2015-08-04 Thread Daniel Roseman
On Tuesday, 4 August 2015 17:32:11 UTC+1, Alex Heyden wrote: > > I don't quite follow what you're doing with set_first_call_true and > set_first_call_false. Are you using that to control the for loop behavior? > > If you are, take a look at > https://docs.djangoproject.com/en/1.8/ref/templates/bu

Re: Passing parameters / attributes to javascript in a template

2015-08-04 Thread Alex Heyden
I don't quite follow what you're doing with set_first_call_true and set_first_call_false. Are you using that to control the for loop behavior? If you are, take a look at https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#for. Django's template language has that built in. If you're push

Re: Passing parameters / attributes to javascript in a template

2015-08-04 Thread Déborah Leder
After some more tests, I have managed to understand where my problem is (but I don't know how to resolve it). Here is my final piece of code : my_markers = [ {{ mymodel.set_first_call_true }} {% for current_addr in mymodel.addresses.all %} {% if not mymodel.first_call %},{%

Re: Passing parameters / attributes to javascript in a template

2015-08-04 Thread Vijay Khemlani
Have you checked the HTML that is actually rendered by the Django template? On Tue, Aug 4, 2015 at 10:39 AM, Déborah Leder wrote: > Hello Larry, thank you for your response. > > I didn't run the debugger, but i know that my values are correctly passed > in the template (when it it outside of the

Re: Passing parameters / attributes to javascript in a template

2015-08-04 Thread Déborah Leder
Hello Larry, thank you for your response. I didn't run the debugger, but i know that my values are correctly passed in the template (when it it outside of the script tags), because at the end of my template, I have also written the code : {% for current_addr in mymodel.addresses.all %} {{ c

Re: Passing parameters / attributes to javascript in a template

2015-08-04 Thread Larry Martell
On Tue, Aug 4, 2015 at 9:14 AM, Déborah Leder wrote: > Hello > > I am currently developping a django geolocalisation application. Therefore, > I need both python and javascript. > I would like to give some parameters to a script in a template, that is to > say, in my template, I want to use the sc

Passing parameters / attributes to javascript in a template

2015-08-04 Thread Déborah Leder
Hello I am currently developping a django geolocalisation application. Therefore, I need both python and javascript. I would like to give some parameters to a script in a template, that is to say, in my template, I want to use the script tag to define/modify some javascript variables. Here is m