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 ...