I am trying to display the results from a search that returns in dataframe format such as:
data = {'title': ['Green Moon', 'Blue Dog', 'Orange Sun'],
'url': ['exampele.com/gm', 'example.com/bd', 'example.com/os'],
'text': ['some string 1', 'some string 2', 'some string 3'}
data = pd.DataFrame(data)
I want to display each title as a hyperlink to the url and then the context below it.
I had tried creating lists out of each column and using a for loop but that doesn't allow me to create a hyperlink:
urls = data.url.tolist()
texts = data.text.tolist()
titles = data.title.tolist()
example.html
{% extends 'base.html' %}
{% block content %}
{% for title in titles %}
{{ title }}
{% endfor %}
{% for text in texts %}
{{ text }}
{% endfor %}
{% endblock %}
Expected Output with each title leading to the specified url:
Green Moon
some string 1
Blue Dog
some string 2
Orange Sun
some string 3