Fix a bug : take last posts and not first if there is no new posts with the current year

This commit is contained in:
Gregory Soutade 2013-01-02 10:47:15 +01:00
parent 224faf5dc4
commit bf86e7a81b
2 changed files with 2 additions and 2 deletions

View File

@ -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()[:self.posts_per_page]
posts = Post.objects.all().order_by('-creation_date')[:self.posts_per_page]
self.dirname = ''
self.generatePages(dom, posts, src, output, 'index')

View File

@ -18,7 +18,7 @@ import sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dynastie.settings")
dynastie_root = '/home/soutade/Projets_Perso/dynastie2/dynastie/'
dynastie_root = '/home/soutade/dynastie/'
if dynastie_root not in sys.path:
sys.path.append(dynastie_root)
dynastie_root += 'dynastie/'