Spider
2006-07-12 16:09:22 UTC
I have this loop in a template :
{% for s in p.schedule_set.all() %}
The template engine complains with "Could not parse the remainder: ()"
Here p is a Plan object instance. Schedule has Plan as a many-to-one
foreign key (each Plan has 1 or more Schedules).
What I want is to loop through all the Schedules associated with this
Plan. I know that p.schedule_set.all() gives me this, so I guess this
is a limitation of the template parser. Is there a way to achieve what
I want?
I did think of doing the p.schedule_set.all() in my view and passing
the result in, but there problem is that there is a further level of
nesting - each schuled consist of a number of visits, so notionally
what I want is nested loops :
{% for s in p.schedule_set.all() %}
{% for v in s.visit_set.all() %}
I suppose I could pass in nested dictionaries from the view ...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users-***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---
{% for s in p.schedule_set.all() %}
The template engine complains with "Could not parse the remainder: ()"
Here p is a Plan object instance. Schedule has Plan as a many-to-one
foreign key (each Plan has 1 or more Schedules).
What I want is to loop through all the Schedules associated with this
Plan. I know that p.schedule_set.all() gives me this, so I guess this
is a limitation of the template parser. Is there a way to achieve what
I want?
I did think of doing the p.schedule_set.all() in my view and passing
the result in, but there problem is that there is a further level of
nesting - each schuled consist of a number of visits, so notionally
what I want is nested loops :
{% for s in p.schedule_set.all() %}
{% for v in s.visit_set.all() %}
I suppose I could pass in nested dictionaries from the view ...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users-***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---