]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/templatetags/node_tags.py
adding a setting that allows the users to choose the comments order
[osqa.git] / forum / templatetags / node_tags.py
index 5cdd3b05d46aa1ef3a59edc5fbd5f76f9b6be0ed..69260c4a8e2f4bcaa7876747a6e9251686179dcb 100644 (file)
@@ -182,7 +182,8 @@ def post_controls(post, user):
 \r
 @register.inclusion_tag('node/comments.html')\r
 def comments(post, user):\r
-    all_comments = post.comments.filter_state(deleted=False).order_by('-added_at')\r
+    all_comments = post.comments.filter_state(deleted=False)\\r
+                                .order_by('-added_at' if settings.SHOW_LATEST_COMMENTS_FIRST else 'added_at')\r
 \r
     if len(all_comments) <= 5:\r
         top_scorers = all_comments\r
@@ -233,6 +234,7 @@ def comments(post, user):
         'showing': showing,\r
         'total': total,\r
         'more_comments_count' : int(total - showing),\r
+        'show_latest_comments_first' : settings.SHOW_LATEST_COMMENTS_FIRST,\r
         'user': user,\r
     }\r
 \r