def _get_last_entries(db, qty):
doc_ids = [post.doc_id for post in db.posts.all()]<EOL>doc_ids = sorted(doc_ids, reverse=True)<EOL>entries = [Entry(os.path.join(CONFIG['<STR_LIT>'],<EOL>db.posts.get(doc_id=doc_id)['<STR_LIT:filename>']), doc_id)<EOL>for doc_id in doc_ids]<EOL>entries.sort(key=operator.attrgetter('<STR_LIT:date>'), reverse=True)<EOL>return entries[:qty], entries<EOL>
get all entries and the last qty entries