Re: Django regroup not working as expected

2010-10-07 Thread Scott Gould
Your .list is in the wrong place:


{% for date in sale_list%}
{{ date.grouper }}

{% for sale in date.list %}
 {{ sale.item }} - {{ sale.qty }} 
{% endfor %}


{% endfor %}


Regards
Scott

On Oct 5, 2:28 pm, Gath  wrote:
> 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 %}
>
> 
>     {% for sale_date in sale_list.list %}
>     {{ sale_date.grouper }}
>     
>         {% for sale in sale_list %}
>          {{ sale.item }} - {{ sale.qty }} 
>         {% endfor %}
>     
>     
>     {% endfor %}
> 
>
> 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-us...@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.



Django regroup not working as expected

2010-10-05 Thread Gath
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 %}


{% for sale_date in sale_list.list %}
{{ sale_date.grouper }}

{% for sale in sale_list %}
 {{ sale.item }} - {{ sale.qty }} 
{% endfor %}


{% endfor %}


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