From 07debf667a746de3fa3dea1579a75c625c6d25c7 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Mon, 23 May 2016 17:54:05 +0200 Subject: [PATCH] fix video and artist publishing --- app/festival/models.py | 2 +- app/festival/views.py | 6 ++++++ app/templates/base.html | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/festival/models.py b/app/festival/models.py index f937090b..15a96562 100644 --- a/app/festival/models.py +++ b/app/festival/models.py @@ -218,4 +218,4 @@ class VideoCategory(Slugged): db_table = app_label + '_video_category' def count(self): - return self.videos.all().count() + return self.videos.published().count()+1 diff --git a/app/festival/views.py b/app/festival/views.py index 29f46285..75feeaac 100644 --- a/app/festival/views.py +++ b/app/festival/views.py @@ -19,6 +19,9 @@ class ArtistListView(ListView): model = Artist template_name='festival/artist_list.html' + def get_queryset(self, **kwargs): + return self.model.objects.published() + def get_context_data(self, **kwargs): context = super(ArtistListView, self).get_context_data(**kwargs) return context @@ -40,6 +43,9 @@ class VideoListView(ListView): model = Video template_name='festival/video_list.html' + def get_queryset(self, **kwargs): + return self.model.objects.published() + def get_context_data(self, **kwargs): context = super(VideoListView, self).get_context_data(**kwargs) context['categories'] = VideoCategory.objects.all() diff --git a/app/templates/base.html b/app/templates/base.html index 64cafbeb..e09d7ce0 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -245,3 +245,4 @@ + -- 2.39.5