1{% if athlete_list %}
2 Number of athletes: {{ athlete_list|length }}
3{% elif athlete_in_locker_room_list %}
4 Athletes should be out of the locker room soon!
5{% else %}
6 No athletes.
7{% endif %}
1#views.py
2#You should instead pass places_count via the context to the template:
3def places(request):
4 places = Places.objects.order_by('-published_date')[:10]
5 places_count = Places.objects.count()
6 return render(
7 request, 'templates/places.html', {'places':places, 'places_count': places_count}
8 )
9#in your templatee
10<div class="container">
11 <h2>Places <span class="badge">{{ places_count }}</span></h2>
12</div>