How can i display my data in database and export it to pdf -Django

后端 未结 1 1817
你的背包
你的背包 2021-01-29 06:40

my x variable is getting all the data in my database, i guess? someone help me how can i display all data and export it to pdf file.

response = HttpResponse(cont         


        
相关标签:
1条回答
  • 2021-01-29 06:53

    Your variable x won't return anything you can print into the PDF, because its a queryset and not a couple strings attached to each other. I just started working with Django and getting the values works something like this:

    x = Item.objects.all[0].name
    

    This code snippet will assign the vale of the row name of the first entry in your Item table to the variable x.

    For more Information I can only recommend reading the Tutorial about writing queries on the django website.

    0 讨论(0)
提交回复
热议问题