Skip to content
This repository was archived by the owner on Sep 7, 2018. It is now read-only.

Commit 20fefa3

Browse files
committed
Fixed the error that raises when there are no sticky posts.
1 parent 2d4a784 commit 20fefa3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

langdev/web/templates/forum/posts.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
{% endif %}
1212
{% if view == 'summary' %}
1313
{% set grouped = posts|groupby('sticky') %}
14-
{% set posts = grouped[True].list %}
14+
{% set posts = (grouped[True]|default({})).list %}
1515
{% set other_posts = grouped[False].list %}
1616
{% endif %}
17+
{% if posts %}
1718
<table>
1819
<thead>
1920
<tr>
@@ -35,9 +36,9 @@
3536
{{- post.author -}}
3637
</a>
3738
</td>
38-
<th class="title">
39+
<td class="title">
3940
<a href="{{ url_for('post', post_id=post.id) }}">{{ post }}</a>
40-
</th>
41+
</td>
4142
<td class="created-at">
4243
<time datetime="{{ post.created_at.isoformat() }}">
4344
{{- post.created_at.date() -}}
@@ -47,6 +48,7 @@
4748
{% endfor %}
4849
</tbody>
4950
</table>
51+
{% endif %}
5052
{% if other_posts %}
5153
<div id="post-summaries">
5254
{% for post in other_posts %}

0 commit comments

Comments
 (0)