splash of color / sorting
parent
a1ceb740dd
commit
41ce6b67c0
|
@ -53,10 +53,12 @@ def get_random():
|
||||||
def get_guestbook():
|
def get_guestbook():
|
||||||
data_dir = app.config['DATA_DIR']
|
data_dir = app.config['DATA_DIR']
|
||||||
# TODO sort by timestamp
|
# TODO sort by timestamp
|
||||||
posts = map(lambda p: json.loads(slurp(os.path.join(data_dir, p))), os.listdir(data_dir))
|
filename_to_json = lambda p: json.loads(slurp(os.path.join(data_dir, p)))
|
||||||
|
posts = map(filename_to_json, os.listdir(data_dir))
|
||||||
|
sorted_posts = sorted(posts, key=lambda p: p['timestamp'])
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
"posts": posts,
|
"posts": sorted_posts,
|
||||||
}
|
}
|
||||||
context.update(site_context())
|
context.update(site_context())
|
||||||
return render_template('guestbook.html', **context)
|
return render_template('guestbook.html', **context)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>{{site_name}} guestbook</title>
|
<title>{{site_name}} guestbook</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="http://tilde.town/style.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>{{site_name}} guestbook</h1>
|
<h1>{{site_name}} guestbook</h1>
|
||||||
|
|
Reference in New Issue