Changes between Initial Version and Version 1 of Ticket #10302, comment 10
- Timestamp:
- Jul 31, 2015, 3:02:46 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #10302, comment 10
initial v1 2 2 When I didn't have that last .order_by things went mad as for @gmayer but as soon as I added my own order I could put back the ordering in the model's Meta class. 3 3 Don't know if will help but it's a workaround if you need ordering in the Meta class. 4 4 {{{ 5 5 def period_avrage(self, start_at=None, end_at=None, period_size='day'): 6 6 extra_psql={'period': "DATE_TRUNC('%s', \"collector_taglog\".\"created_at\")" % period_size} … … 10 10 #do not remove the order by. Otherwise the ordering on the model will screw things up 11 11 return qs.extra(select=extra_psql).values('period').annotate(avg=Avg('v_num')).order_by('period') 12 }}}