I need to display total count & also use the queryset to loop on the template ! But the thing is its causing two queries to do this, is there any efficient way to manage this on single query ?
data = Data.objects.filter(pk=pk)
count = data.count // 1st query
and then using data to iterate over loop on template // this makes second query
Is there any other best way to do the same thing or it needs these two queries for sure ?