diff --git a/flaskr/blog.py b/flaskr/blog.py index 6bf9b55..8082d2f 100644 --- a/flaskr/blog.py +++ b/flaskr/blog.py @@ -86,9 +86,10 @@ def get_post(id, check_author=True): return post -@bp.route('/') +@bp.route('//') def individual_post(id): - post = get_post(id, False) + post = dict(get_post(id, False)) + post['body'] = markdown.markdown(post['body']) return render_template('blog/post.html', post=post) @bp.route('//update', methods=('GET', 'POST')) diff --git a/flaskr/templates/blog/index.html b/flaskr/templates/blog/index.html index 7f1e4e8..f50de7f 100644 --- a/flaskr/templates/blog/index.html +++ b/flaskr/templates/blog/index.html @@ -12,7 +12,7 @@
-

{{ post['title'] }}

+

{{ post['title'] }}

by {{ post['username'] }} on {{ post['created'].strftime('%Y-%m-%d') }}
{% if g.user['id'] == post['author_id'] %} diff --git a/tests/test_blog.py b/tests/test_blog.py index 175e5b5..548363a 100644 --- a/tests/test_blog.py +++ b/tests/test_blog.py @@ -13,6 +13,7 @@ def test_index(client, auth): assert b'by test on 2018-01-01' in response.data assert b'test\nbody' not in response.data assert b'href="/1/update"' in response.data + assert b'href="/1/"' in response.data def test_firehose(client, auth): response = client.get('/') @@ -20,7 +21,7 @@ def test_firehose(client, auth): assert b"Register" not in response.data auth.login() - response = client.get('/') + response = client.get('/firehose') assert b'Log Out' in response.data assert b'test title' in response.data assert b'by test on 2018-01-01' in response.data @@ -28,7 +29,7 @@ def test_firehose(client, auth): assert b'href="/1/update"' in response.data def test_individual_page(client, auth): - response = client.get('/1') + response = client.get('/1/') assert b'test title' in response.data assert b'by test on 2018-01-01' in response.data assert b'test\nbody' in response.data