How Django2.0 prints data structures, similar to PHP's print_r ()

for example, I defined a method in the view file.

views.py

from django.shortcuts import render
from django.http import HttpResponse

from . import models

def index(request):

    datas = models.Test.objects.get(id=1)
    
    print(datas)  -sharp
    return render(request,"polls/index.html",{"data":datas})

how to print the returned data structure to the page with Django?

Aug.04,2021

data is already plural, so don't use datas. In addition, models.Test.objects.get (id=1)
is used here. If it is found, an instance of model will be returned, and if it cannot be found, an exception will be thrown. This exception may cause you not to print out
the information printed during normal operation is Test object
conclusion:
look at the data structure as print (datas.__dict__)

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c05c-3468e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c05c-3468e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?