#NEWLINE# def list_view( self ) : #NEWLINE# #INDENT# query = Index . select ( Index , fn . COUNT ( IndexDocument . id ) . alias ( 'document_count' ) ) . join ( IndexDocument , JOIN_LEFT_OUTER ) . group_by ( Index ) #NEWLINE# ordering = request . args . getlist ( 'ordering' ) #NEWLINE# query = apply_sorting ( query , ordering , { #NEWLINE# #INDENT# 'name' : Index . name , #NEWLINE# 'document_count' : SQL ( 'document_count' ) , #NEWLINE# 'id' : Index . id , #NEWLINE# #UNINDENT# } , 'name' ) #NEWLINE# pq = self . paginated_query ( query ) #NEWLINE# return jsonify ( { #NEWLINE# #INDENT# 'indexes' : [ index . serialize ( ) for index in pq . get_object_list ( ) ] , #NEWLINE# 'ordering' : query , #NEWLINE# 'page' : pq . get_page ( ) , #NEWLINE# 'pages' : pq . get_page_count ( ) , #NEWLINE# #UNINDENT# } )