#NEWLINE# def get_entries( self , category_id = None , category_name = None , date_from = None , date_to = None , limit = None ) : #NEWLINE# #INDENT# if ( not self . entries ) : #NEWLINE# #INDENT# self . entries = IncomeTable . query . filter ( ( IncomeTable . user == self . user_id ) ) . join ( IncomeCategoriesTable ) . add_columns ( IncomeCategoriesTable . name , IncomeCategoriesTable . slug ) . order_by ( desc ( IncomeTable . date ) ) . order_by ( desc ( IncomeTable . id ) ) #NEWLINE# #UNINDENT# if category_id : #NEWLINE# #INDENT# self . entries = self . entries . filter ( ( IncomeTable . category == category_id ) ) #NEWLINE# #UNINDENT# if category_name : #NEWLINE# #INDENT# self . entries = self . entries . filter ( ( IncomeCategoriesTable . name == category_name ) ) #NEWLINE# #UNINDENT# if ( date_from and date_to ) : #NEWLINE# #INDENT# self . entries = self . entries . filter ( ( IncomeTable . date >= date_from ) ) . filter ( ( IncomeTable . date <= date_to ) ) #NEWLINE# #UNINDENT# if limit : #NEWLINE# #INDENT# self . entries = self . entries . limit ( limit ) #NEWLINE# #UNINDENT# return self . entries