Changes between Initial Version and Version 1 of Ticket #10302, comment 10


Ignore:
Timestamp:
Jul 31, 2015, 3:02:46 PM (9 years ago)
Author:
Tim Graham

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #10302, comment 10

    initial v1  
    22When 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.
    33Don't know if will help but it's a workaround if you need ordering in the Meta class.
    4 
     4{{{
    55def period_avrage(self, start_at=None, end_at=None, period_size='day'):
    66    extra_psql={'period': "DATE_TRUNC('%s', \"collector_taglog\".\"created_at\")" % period_size}
     
    1010    #do not remove the order by. Otherwise the ordering on the model will screw things up
    1111    return qs.extra(select=extra_psql).values('period').annotate(avg=Avg('v_num')).order_by('period')
     12}}}
Back to Top