Commit 3c8e58d2 authored by Floréal Cabanettes's avatar Floréal Cabanettes

Fix missing sort + only show published recipes on index pages

parent 6f569b3f
......@@ -53,10 +53,12 @@ class IndexView(TemplateView):
dat["archive_header"] = _("Author:") + " " + \
UserProfile.objects.get(url=self.kwargs["author"]).user.first_name
dat["additional_kwargs"] = {"author": self.kwargs["author"]}
recipes = Recipe.objects.filter(author__url=self.kwargs["author"])
recipes = Recipe.objects.filter(author__url=self.kwargs["author"]).order_by("-pub_date")
else:
recipes = Recipe.objects.all().order_by("-pub_date")
recipes =recipes.filter(published=True)
paginator = Paginator(recipes, POSTS_PER_PAGE)
try:
page_recipe = paginator.page(page)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment