diff --git a/articles/templates/articles/article_list.html b/articles/templates/articles/article_list.html index f93356e..ba636a6 100644 --- a/articles/templates/articles/article_list.html +++ b/articles/templates/articles/article_list.html @@ -8,5 +8,7 @@

{{ article.get_abstract|safe }}

Read more

+ {% empty %} +

No article here. Come back later 🙂

{% endfor %} {% endblock %} diff --git a/articles/views.py b/articles/views.py index 5c5d847..f138c99 100644 --- a/articles/views.py +++ b/articles/views.py @@ -8,7 +8,13 @@ class ArticlesListView(generic.ListView): paginate_by = 15 context_object_name = "articles" + def get_queryset(self): + return super().get_queryset().filter(status=Article.PUBLISHED) + class ArticleDetailView(generic.DetailView): model = Article context_object_name = "article" + + def get_queryset(self): + return super().get_queryset().filter(status=Article.PUBLISHED)