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:
parent
bf86e7a81b
commit
7ea8fd9280
|
@ -65,13 +65,10 @@ class Archive(Index):
|
||||||
my_post.append(posts[i])
|
my_post.append(posts[i])
|
||||||
else:
|
else:
|
||||||
# Last post
|
# 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:
|
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)
|
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:
|
if not self.somethingWrote:
|
||||||
self.addReport('Nothing changed')
|
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')
|
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:
|
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.dirname = ''
|
||||||
self.generatePages(dom, posts, src, output, 'index')
|
self.generatePages(dom, posts, src, output, 'index')
|
||||||
|
|
2
wsgi.py
2
wsgi.py
|
@ -18,7 +18,7 @@ import sys
|
||||||
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dynastie.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dynastie.settings")
|
||||||
|
|
||||||
dynastie_root = '/home/soutade/dynastie/'
|
dynastie_root = '/home/soutade/Projets_Perso/dynastie2/dynastie/'
|
||||||
if dynastie_root not in sys.path:
|
if dynastie_root not in sys.path:
|
||||||
sys.path.append(dynastie_root)
|
sys.path.append(dynastie_root)
|
||||||
dynastie_root += 'dynastie/'
|
dynastie_root += 'dynastie/'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user