I am trying to use the OpenDOTA API in my pet project. At the moment, I am having problem displaying the content of the API into my CBV.
My views.py:
from django.views.generic import TemplateView
import requests
import json
# Create your views here.
class HeroList(TemplateView):
template_name = 'dota/heroes.html'
url = 'https://api.opendota.com/api/heroes'
r = requests.get(url)
r.text
result = r.json()
I am lost on how to call the json in my HTML. I've tried running the same code in python IDLE, and when I type the "result" and hit enter, it gives my the dict. Any idea on how should I display the dict into my template?