[SOLVED]Show data from API on Django tempalte

highcenburg

Vicente G. Reyes

Posted on April 15, 2020

[SOLVED]Show data from API on Django tempalte

This is the continuation of my question yesterday and I'm now trying to show the fetched data on the django template.

Can anyone help me?

2

I'm trying to show the fetched data on an API to the Django template.

Here's what I've tried on home.html

<h1>Title: {{data.title}}</h1>

Here's my views.py which gets the data from services.py

class IndexData(TemplateView):
    def get(self, request):
        article_data = services.get_data()
        return render(request, 'pages/home.html', article_data)

Here's the services.py

def get_data(title, url, description,
💖 💪 🙅 🚩
highcenburg
Vicente G. Reyes

Posted on April 15, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related