I Have data in Postgresql and getting that data through ORM query into my dataframe named as data, My view.py is given below:
view.py
from operator import index
from django.shortcuts import redirect, render
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.shortcuts import render
from bar_chart.models import AirQuality
from django.core.paginator import Paginator
#from django.views.generic import TemplateView
#from django.shortcuts import render
#from django.db.models import Sum
from django.db.models import Avg
from django.http import JsonResponse
from bar_chart.models import AirQuality
#from .models import *
import pandas as pd
# Create your views here.
def authenticate(request):
count= User.objects.count()
data= AirQuality.objects.all().values()
print(data)
df= pd.DataFrame(data)
df1= df.tail(10)
mydic = {
"df": df1.to_html()
#"count": count
}
return render(request, 'auth_home.html', context=mydic)
#, {'count':count}
I want to render those pages of pandas dataframe (All data not just the tail of data) in my auth_home.html. What would be the way out (code) to apply django pagination on my pandas dataframe?