Tuesday, October 5, 2010

Django regroup not working as expected

Guys

I have the following view in my django application

def ViewSale( request ):
salecur = Sale.objects.filter(user=2).order_by('sale_date')
return render_to_response('myapp/sale.html',{'salecur':salecur})
my template looks like this

{% regroup salecur by sale_date as sale_list %}

<ul>
{% for sale_date in sale_list.list %}
<li>{{ sale_date.grouper }}
<ul>
{% for sale in sale_list %}
<li>{{ sale.item }} - {{ sale.qty }} </li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>

When i render the page i get the grouper sale_date.grouper printed,
but {{ sale.item }} and {{ sale.qty }} in the inner loop shows
nothing! Blank.

What am i missing?

Gath

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

Subscribe to Post Comments [Atom]

<< Home


Real Estate