Fix a bug in archive generator due to factorization
Filter posts for new year adding published and front page criteria
This commit is contained in:
		| @@ -65,13 +65,10 @@ class Archive(Index): | ||||
|                     my_post.append(posts[i]) | ||||
|             else: | ||||
|                 # Last post | ||||
|                 my_post.append(post) | ||||
|                 my_post.append(posts[i]) | ||||
|                 if nb_post != 1 and posts[i].creation_date.year != posts[i-1].creation_date.year: | ||||
|                     self.cur_year = int(posts[i].creation_date.year) | ||||
|  | ||||
|         if len(my_post) != 0: | ||||
|             self.createArchives(src, output, dom, self.hooks, my_post) | ||||
|  | ||||
|         if not self.somethingWrote: | ||||
|             self.addReport('Nothing changed') | ||||
|  | ||||
|   | ||||
| @@ -359,7 +359,7 @@ class Index(DynastieGenerator): | ||||
|         posts = Post.objects.filter(creation_date__year=cur_year, published=True, front_page=True).order_by('-creation_date') | ||||
|  | ||||
|         if posts.count() < self.posts_per_page: | ||||
|             posts = Post.objects.all().order_by('-creation_date')[:self.posts_per_page] | ||||
|             posts = Post.objects.filter(published=True, front_page=True).order_by('-creation_date')[:self.posts_per_page] | ||||
|  | ||||
|         self.dirname = '' | ||||
|         self.generatePages(dom, posts, src, output, 'index') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user