def view_entries(search_query=None):
 query = Entry.select().order_by(Entry.timestamp.desc())
 if search_query:
  query = query.where(Entry.content.contains(search_query))
 for entry in query:
  timestamp = entry.timestamp.strftime('%A %B %d, %Y %I:%M%p')
  print timestamp
  print ('=' * len(timestamp))
  print entry.content
  print 'n) next entry'
  print 'd) delete entry'
  print 'q) return to main menu'
  action = raw_input('Choice? (Ndq) ').lower().strip()
  if (action == 'q'):
   break
  elif (action == 'd'):
   entry.delete_instance()
   break

def view_entries ( search_query = None ) : query = Entry . select ( ) . order_by ( Entry . timestamp . desc ( ) ) if search_query : query = query . where ( Entry . content . contains ( search_query ) ) for entry in query : timestamp = entry . timestamp . strftime ( '%A %B %d, %Y %I:%M%p' ) print timestamp print ( '=' * len ( timestamp ) ) print entry . content print 'n) next entry' print 'd) delete entry' print 'q) return to main menu' action = raw_input ( 'Choice? (Ndq) ' ) . lower ( ) . strip ( ) if ( action == 'q' ) : break elif ( action == 'd' ) : entry . delete_instance ( ) break
view previous entries .