Suppose I want to know what the array contains, like JS concole.log() or php var_dump
def showArticle(request):
articles = Article.objects.all()
return render(request, 'article.html', {'articles': articles})
My template:
<pre>
{{ articles }}
</pre>
It shows:
<QuerySet [<Article: Article object>]>
If I use
{% for article in articles %}
{{ article }}
{% endfor %}
It will show the same
Article object
Article object
Article object
and if I want show request.
def printRequest(request):
req = str(request)
print(request)
it prints only:
<WSGIRequest: GET '/'>