Thank you very much guys. I used George's way to get it working. Thanks again
Vedlen On May 3, 12:32 pm, Daniel Roseman <roseman.dan...@googlemail.com> wrote: > On May 3, 2:24 am, Vedlen <ved...@hotmail.de> wrote: > > > > > I've got multiple tuples, and I need all the fields. > > I just need to pass all the "moment" fields from the tuples, into my > > function. > > > Here is what my template looks like : > > > <table> > > {{ for s in Score }} > > <tr><td>{{ s.moment }}</td><td>{{ s.someOtherField }}</td></tr> > > {{ endfor }} > > </table> > > > It's like I'd need to do this : > > > <table> > > {{ for s in Score }} > > <tr><td>{{ DateFr(s.moment) }}</td><td>{{ s.someOtherField }}</td></ > > tr> > > {{ endfor }} > > </table> > > > but it doesn't work since you can't call functions in templates :( so > > I need to alter the "moment" fields before getting to the template > > thing, you know what I mean. It's a pretty basic task when you know > > Django pretty well though, but I don't :) > > > Thank you for your help > > George and Michael have given you some good pointers - personally I'd > go with a method on the Score model. But the immediate source of your > problem, which is giving you the 'unsubscriptable' error, is that you > seem to be passing the Score model itself into the template, rather > than a queryset. > > Just for clarification, you can indeed call functions in templates - > what you can't do is pass parameters into them. So if your model has a > date_fr method, you can call {{ sc.date_fr }} as long as sc is an > instance of Score - you don't need the () brackets. > -- > DR. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---