Santhosh
Santhosh

Reputation: 11788

Django debugging: how to pretty print an object in template

In Django i want to know how to see the full objects which may have nested objects like model, formset etc in template as html or <pre> element

Is it possible.

Because it will help me to debug and check the results.

Upvotes: 2

Views: 2273

Answers (1)

Emilio Conte
Emilio Conte

Reputation: 1145

I just came up on that question that hasn't the right answer which is using the special built-in template filter pprint.

# in your template

<pre>{{ my_value | pprint }}</pre>

As said in the docstring, it helps, really.

Upvotes: 7

Related Questions