reverse a sort

master
nathaniel smith 2015-08-01 17:19:56 -07:00
parent 41ce6b67c0
commit a49376017d
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,7 @@ def get_guestbook():
# TODO sort by timestamp # TODO sort by timestamp
filename_to_json = lambda p: json.loads(slurp(os.path.join(data_dir, p))) filename_to_json = lambda p: json.loads(slurp(os.path.join(data_dir, p)))
posts = map(filename_to_json, os.listdir(data_dir)) posts = map(filename_to_json, os.listdir(data_dir))
sorted_posts = sorted(posts, key=lambda p: p['timestamp']) sorted_posts = sorted(posts, key=lambda p: p['timestamp'], reverse=True)
context = { context = {
"posts": sorted_posts, "posts": sorted_posts,