Skip to content
Permalink
Browse files

Reverse sorting keys (h/t @felixfontein)

  • Loading branch information
Kwpolska committed Dec 27, 2016
1 parent e1c5a87 commit 1be9098f5fd3d13e9387c15e5c8a4afc7cf994ed
Showing with 4 additions and 1 deletion.
  1. +4 −1 nikola/utils.py
@@ -1964,7 +1964,10 @@ def sort_posts(posts, *keys, **kwargs):
reverse = kwargs['reverse']
else:
reverse = False
for key in keys:
# we reverse the keys to get the usual ordering method: the first key
# provided is the most important sorting predicate (first by 'title', then
# by 'date' in the first example)
for key in reversed(keys):
try:
# an attribute (or method) of the Post object
a = getattr(posts[0], key)

0 comments on commit 1be9098

Please sign in to comment.
You can’t perform that action at this time.