Permalink
Browse files

fix summary month list, filter for user

  • Loading branch information...
1 parent 99bd69e commit eddbef57c805b6843dba747d81b6dd920791673d @dfalk committed Apr 9, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 fprice/views.py
View
2 fprice/views.py
@@ -126,7 +126,7 @@ def summary_list(request, page=0, template_name='fprice/summary_list.html', **kw
queryset = Summary.objects.filter(user=request.user).filter(time__gt=datetime.datetime.now()-datetime.timedelta(days=30))
summary_sum = queryset.aggregate(Sum('summary'))
#month_list = Summary.objects.filter(time__gt=datetime.datetime.now()-datetime.timedelta(days=365)).dates('time','month',order='DESC')
- month_list = Summary.objects.filter(time__gt=datetime.datetime.now()-datetime.timedelta(days=365)).extra(select={'year': connections[Summary.objects.db].ops.date_extract_sql('year', 'time'), 'month': connections[Summary.objects.db].ops.date_extract_sql('month', 'time')}).values('year','month').annotate(sum=Sum('summary')).order_by('-year','-month')
+ month_list = Summary.objects.filter(user=request.user).filter(time__gt=datetime.datetime.now()-datetime.timedelta(days=365)).extra(select={'year': connections[Summary.objects.db].ops.date_extract_sql('year', 'time'), 'month': connections[Summary.objects.db].ops.date_extract_sql('month', 'time')}).values('year','month').annotate(sum=Sum('summary')).order_by('-year','-month')
return list_detail.object_list(
request,
queryset = queryset,

0 comments on commit eddbef5

Please sign in to comment.