#NEWLINE# def get_context_data( self , **kwargs ) : #NEWLINE# #INDENT# context = super ( HourlyReport , self ) . get_context_data ( ** kwargs ) #NEWLINE# entries = context [ 'entries' ] #NEWLINE# date_headers = context [ 'date_headers' ] #NEWLINE# summaries = [ ] #NEWLINE# if context [ 'entries' ] : #NEWLINE# #INDENT# summaries . append ( ( 'By User' , get_project_totals ( entries . order_by ( 'user__last_name' , 'user__id' , 'date' ) , date_headers , 'total' , total_column = True , by = 'user' ) ) ) #NEWLINE# entries = entries . order_by ( 'project__type__label' , 'project__name' , 'project__id' , 'date' ) #NEWLINE# func = ( lambda x : x [ 'project__type__label' ] ) #NEWLINE# for ( label , group ) in groupby ( entries , func ) : #NEWLINE# #INDENT# title = ( label + ' Projects' ) #NEWLINE# summaries . append ( ( title , get_project_totals ( list ( group ) , date_headers , 'total' , total_column = True , by = 'project' ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# from_date = context [ 'from_date' ] #NEWLINE# from_date = ( utils . add_timezone ( from_date ) if from_date else None ) #NEWLINE# to_date = context [ 'to_date' ] #NEWLINE# to_date = ( utils . add_timezone ( to_date ) if to_date else None ) #NEWLINE# trunc = context [ 'trunc' ] #NEWLINE# ( date_headers , range_headers ) = self . get_headers ( date_headers , from_date , to_date , trunc ) #NEWLINE# context . update ( { #NEWLINE# #INDENT# 'date_headers' : date_headers , #NEWLINE# 'summaries' : OrderedDict ( summaries ) , #NEWLINE# 'range_headers' : range_headers , #NEWLINE# #UNINDENT# } ) #NEWLINE# return context