okay so i temporarily removed the loop just to see if the template works $(function() { var data = [];
data[0] = { roll_no: {{content[0].roll_no}}, cell_no: {{content[0].cell_no}}, nationality:{{content[0].nationality}}, e_mail:{{content[0].e_mail}} }; grid = new Slick.Grid("#myGrid", data, columns, options); $("#myGrid").show(); }) The final return in the view which calls the above templates is return render_to_response("db.html",{'content':list}) and now i am getting the exception Exception Value: Could not parse the remainder: '[0].roll_no' from 'content[0].roll_no' any ideas??? On Tue, Aug 16, 2011 at 4:58 AM, Landy Chapman <landy.chapm...@gmail.com>wrote: > > > On Aug 15, 11:45 pm, Adam Zedan <zedan...@gmail.com> wrote: > > Hi i am getting a problem with my for loop which i used in my > template.Could > > you kindly let me know what is going wrong in here. > > The for loop is in a jquery function > > I think this: > > {% for x in range(len(content)) %} > > .. is not allowed --no python in django templates. > > Do you have a sample (2 or 3 elements) showing how content is defined? > If content came from a query, this should work: > > > {% for x in content %} > > data[i] = > > { > > roll_no: {{x.roll_no}}, > > cell_no: {{x.cell_no}}, > > nationality:{{x.nationality}}, > > e_mail:{{x.e_mail}} > > }; > > {% endfor %} > > -- > 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. > > -- 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.