I want to take the list created by the following function (list of counters) and print that out on an HTML Django template. I know that in the HTML I'll need
{% for i in listofcounters %}
<p> {{ something here maybe? }} </p>
{% endfor %}
But really the confusion is coming from where the function goes (in views.py? or is it a model?) and then how to get it so the HTML page can read it.
Also, I'm aware that what I might be doing isn't the "best" way to present this information, but this is for me to understand Django better by creating a toy project that I'm interested in. It's not for a "real" site. So, in saying that, I ask that you don't suggest anything too far outside my original question. That being "here's my function, how can I get its output in HTML form?" unless you feel it's impossible to do so.
from mtgsdk import Card
def findcounters():
listofcounters = []
cards_from_set = Card.where(set='iko').all()
for card in cards_from_set:
if "counter target" in str(card.text).lower():
listofcounters.append(card.name)
listofcounters = list(dict.fromkeys(listofcounters))
return listofcounters