Remove those counts because I can just use |length

This commit is contained in:
Evert Prants 2017-11-11 10:12:39 +02:00
parent 94b54a0ef2
commit 1e868efb72
Signed by: evert
GPG Key ID: 1688DA83D222D0B5

View File

@ -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