#NEWLINE# def latest_records( resource , layout , list_id , limit , list_fields , orderby ) : #NEWLINE# #INDENT# '\n        Display a dataList of the latest records for a resource\n    ' #NEWLINE# ( datalist , numrows , ids ) = resource . datalist ( fields = list_fields , start = None , limit = limit , list_id = list_id , orderby = orderby , layout = layout ) #NEWLINE# if ( numrows == 0 ) : #NEWLINE# #INDENT# from s3.s3crud import S3CRUD #NEWLINE# table = resource . table #NEWLINE# if ( 'deleted' in table ) : #NEWLINE# #INDENT# available_records = current . db ( ( table . deleted != True ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# available_records = current . db ( ( table . _id > 0 ) ) #NEWLINE# #UNINDENT# if available_records . select ( table . _id , limitby = ( 0 , 1 ) ) . first ( ) : #NEWLINE# #INDENT# msg = DIV ( S3CRUD . crud_string ( resource . tablename , 'msg_no_match' ) , _class = 'empty' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msg = DIV ( S3CRUD . crud_string ( resource . tablename , 'msg_list_empty' ) , _class = 'empty' ) #NEWLINE# #UNINDENT# data = dl #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# dl = datalist . html ( ) #NEWLINE# data = dl #NEWLINE# #UNINDENT# return data