How to print data in Django views.py not in template?

I am new to Django and I know how to get the data from the database and send to the template. But i am in a situation where I need to print the data from the database in views.py file

order = Order.objects.get(user=request.user, ordered=False)
context['object']=order
return render(request,"Orderview.html",context)

this order variable contains title,quantity,price of the product

{% for order_item in object.items.all %}
                <tr>
                <td>1</td>
                <td><strong>{{ order_item.item.title }}<</strong><br>{{order_item.item.description }}</td>
                <td class="text-center">{{ order_item.quantity }}</td>
                <td class="text-right" id="price" >{{ order_item.item.price }}</td>
                <td class="text-right" id="discount ">{{ order_item.item.discount_price }}</td>
                <td class="text-right" id="subtotal_price">{{ order_item.item.price|subtract:order_item.item.discount_price }}</td>
                </tr>

               {% endfor %}

This is how I’m able to send all the details to template. But I want to print all this details to the views.py console.

Answer

If you are asking how to print data to console then you can just use print(data) and this will print the data to the console. If you want to print context then:

order = Order.objects.get(user=request.user, ordered=False)
context['object']=order
print(context)
return render(request,"Orderview.html",context)