get all entries and the last qty entries

def _get_last_entries(db, qty):
    """get all entries and the last qty entries"""
    doc_ids = [post.doc_id for post in db.posts.all()]
    doc_ids = sorted(doc_ids, reverse=True)
    # bug: here we shoud only render doc_ids[:qty]
    # but we can't use mtimes for sorting. We'll need to add ptime for the
    # database (publish time)
    entries = [Entry(os.path.join(CONFIG['content_root'],
                     db.posts.get(doc_id=doc_id)['filename']), doc_id)
               for doc_id in doc_ids]
    # return _sort_entries(entries)[:qty]
    entries.sort(key=operator.attrgetter('date'), reverse=True)
    return entries[:qty], entries