2👍
✅
You are overwriting the variable person inside your loop.
Change the list person to persons and it should work fine.
Your view:
persons = []
x = people.objects.filter(deal='q')
for person in x:
if person.paid_status == True:
persons.append(person)
return render(request, '.html', {'persons': persons})
Your template:
<div>
{% if persons %}
There are {{ persons|length }} persons.
{% for p in persons %}
<p> {{ p.name }} </p>
{% endfor %}
{% else %}
<p> As of now no persons have appeared. </p>
{% endif %}
</div>
Source:stackexchange.com