Browse Source

Also fill related_posts for draft articles (against published articles of course).

Ionel Cristian Mărieș 8 years ago
parent
commit
b2a2fe3eeb
1 changed files with 2 additions and 2 deletions
  1. 2 2
      related_posts/related_posts.py

+ 2 - 2
related_posts/related_posts.py

@@ -16,7 +16,7 @@ def add_related_posts(generator):
     numentries = generator.settings.get('RELATED_POSTS_MAX', 5)
     # Skip all posts in the same category as the article
     skipcategory = generator.settings.get('RELATED_POSTS_SKIP_SAME_CATEGORY', False)
-    for article in generator.articles:
+    for article in chain(generator.articles, generator.drafts):
         # set priority in case of forced related posts
         if hasattr(article,'related_posts'):
             # split slugs 
@@ -53,4 +53,4 @@ def add_related_posts(generator):
                 in scores.most_common(numentries)]
 
 def register():
-    signals.article_generator_finalized.connect(add_related_posts)
+    signals.article_generator_finalized.connect(add_related_posts)