Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View all Object in Django Template

In this django function

def request(request):
    args = {"name": "name", 'message': "message"}
    return render(request, 'request.html', args)


the template will get {{name}} and {{message}} variable... But apart from these two variable one can also access {{user}} and {{LANGUAGES}} object on template which are set in RequestContext by middleware.

Is there a way to displayed/render every object/variable that are sent to template either by my custom response or by any middleware like IP Address of requesting client, and other information.

like image 849
Kuldeep Rishi Avatar asked Dec 25 '22 13:12

Kuldeep Rishi


2 Answers

You can get all variables and obj using debug

{% debug %}
like image 84
Irshadmi4 Avatar answered Jan 02 '23 21:01

Irshadmi4


If you want to print this vars for debugging only, try django debug toolbar

like image 38
ndpu Avatar answered Jan 02 '23 21:01

ndpu