I have a default dict variable final_d = defaultdict(list) that looks like this:
[(order1, [customer2, customer1]), (order2, [customer3, customer5, customer6]) ]
I've tried everything possible inside the template and I can't unpack this thing. I'm passing final_d to the template inside the dictionary like this: d = {'final_d':final_d}
This is my template which should I think work from what I've read on SO and elsewhere:
<ul class="main-listing">
{% for order, customers in final_d %}
<li>
<h3><a href="{{ order.getabsoluteurl }}">{{ ordder.name }}</a></h3>
<h4>Cusotmers</h4>
<ul class="customers">
{% for customer in customers %}
<li><a href="#">{{ customer.name }}</a></li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
I have tried absolutely everything and I can't get this to render.
The above code doesn't render a result. if I change {% for order, customers in final_d %} to {% for order in final_d %} I do get the order details, but I can't access customer details.
Thank you for your help!
-m
-- 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 comments:
Post a Comment