From 1e868efb72592e1ce2624dd0bb1e4fa9932bb54c Mon Sep 17 00:00:00 2001 From: Evert Date: Sat, 11 Nov 2017 10:12:39 +0200 Subject: [PATCH] Remove those counts because I can just use |length --- Show/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Show/views.py b/Show/views.py index 2c9d158..1646a0c 100644 --- a/Show/views.py +++ b/Show/views.py @@ -23,14 +23,14 @@ class IndexView(TemplateView): ctx = super().get_context_data() # Get show by abbreviation, add episode count to the show and return only the first object - show = Show.objects.filter(abbr=abbreviation).annotate(episode_count=Count('episodes')).first() + show = Show.objects.filter(abbr=abbreviation).first() # 404 if not show: raise Http404("Show does not exist") # Get all seasons of the show and annotate episode counts onto them - seasons = show.seasons.all().annotate(episode_count=Count('episodes')) + seasons = show.seasons.all() # Add fields to context ctx['show'] = show