Wagtail template var_dump equivalent?

874 views
Skip to first unread message

R Stein

unread,
Nov 27, 2016, 12:26:19 AM11/27/16
to Wagtail support
I'm aware this is a dumb question, but I got myself stuck and I can't seem to find a template tag for it in the documentation.

What's the best way to var_dump or pprint a variable in a Wagtail template while debugging?

Daniel

unread,
Nov 27, 2016, 11:20:20 AM11/27/16
to Wagtail support
Hello,

This package should help you a lot while debuging:

Hope it helps.

Tim Allen

unread,
Nov 27, 2016, 9:29:21 PM11/27/16
to Wagtail support
Django Debug Toolbar is a must, agreed, but there's also this:


I'd like to find something in Django that is similar to PHP's `print_r`, `var_dump`, or ColdFusion's CFDUMP (one of the two things ColdFusion got right). Being able to dump a tree of all variables in the context presented from the view to the template would be fantastic, but I haven't found such an animal yet.

Regards,

Tim

Chris May

unread,
Nov 29, 2016, 10:05:32 AM11/29/16
to Wagtail support
I agree with Tim.

Django Templates Debug helped me through several pickles as I've been learning Wagtail. But I didn't realize the project was not python3 ready.

Some of the tags will not output what you expect. I documented them in this issue: https://github.com/calebsmith/django-template-debug/issues/35

Another option I've found useful is django-debugtools: https://github.com/edoburu/django-debugtools
Reply all
Reply to author
Forward
0 new messages