I need to show data from the database to a pdf, until now it generates the pdf but with static data that I added to it
VIEWS.PY
class PDFprueba(View):
def get(self,request,*args,**kwargs):
datos = {
'nombre' : 'jose',
'apellido' : 'florez'
}
pdf= render_pdf('pdf/pdf.html',{'datos': datos})
return HttpResponse(pdf, content_type= 'application/pdf')
MODEL.PY
class Persona(models.Model):
nombre = models.CharField(max_length=50)
apellido = models.CharField(max_length=70)
edad = models.IntegerField()
telefono = models.CharField(max_length=12)
email = models.EmailField()
domicilio = models.TextField()