1👍
✅
You can pass your data like this from views to template
all_result = []
fms = Fm.objects.all()
for x in fms:
result = {}
result['fm']=x.fm
result['hq']=x.hq
result['zone']=x.hq.zone
result['age_count']= User.objects.filter(fm=x).count()
agents= User.objects.filter(fm=x)
result['animal_count']=Animal.objects.filter(agent__in=agents).count()
all_result.append(result)
It worked for me let me know if you still have problems
Source:stackexchange.com