Re: newbie question: generating javascript, avoiding trailing comma

2007-07-19 Thread cjl
Duc & Kevin: Thank you for your quick and accurate replies. It looks like I need to spend more time with the documentation. Kevin's solution fixed my problem. -CJL --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: newbie question: generating javascript, avoiding trailing comma

2007-07-19 Thread Duc Nguyen
It would probably be easier if you processed crime_list in your view and generated a 'crimes' variable for use in your template. cjl wrote: > DU: > > I am a newbie, and I'm working on a simple tutorial for other > newbies. I am trying to generate some javascript, and I have the > following code

Re: newbie question: generating javascript, avoiding trailing comma

2007-07-19 Thread Kevin
There's a forloop.last variable that you could test. Eg: var crimes = [ {% for crime in crime_list %} [ {{crime.longitude}}, {{ crime.latitude }},'{{ crime.address }}','{{ crime.type }}','{{ crime.date }}'] {% if not forloop.last %},{% endif %} {% endfor %} ]; On Jul 19, 12:35 pm, cjl <[EMA

newbie question: generating javascript, avoiding trailing comma

2007-07-19 Thread cjl
DU: I am a newbie, and I'm working on a simple tutorial for other newbies. I am trying to generate some javascript, and I have the following code in my template: var crimes = [ {% for crime in crime_list %} [ {{crime.longitude}}, {{ crime.latitude }},'{{ crime.address }}','{{ crime.type }}',