1#in template you can use the filter length on your model post
2{{ posts|length }}
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>