I want to display data from a file in the django template. I do not know how. If in model or view. Ucsal application.
Model:
from django.db import models
import pandas as pd
class Arquivo(models.Model):
def __dados__(self):
return pd.read_csv("tweets_classificados.csv", encoding='ISO-8859-1', sep=";", header=0)
view
from django.http.response import HttpResponse
from django.shortcuts import render
from .models import Arquivo
def index(request):
Arquivo.__dados__(self) #esta linha dá erro porque não encontra self.
return render(request, 'ucsal/index.html')
I do not know if I import pandas in the model and I pass the one variable with the value of
pd.read_csv("tweets_classificados.csv", encoding='ISO-8859-1', sep=";", header=0)
or if the way I'm doing is correct.
the project is in github: