Sunday, November 22, 2015

Re: List of available Jinja2 global symbols

Hi there, I'm not a Jinja2 user, but standard Django templates get these variables via context processors‎. Check out https://docs.djangoproject.com/en/1.8/topics/templates/#context-processors

 HTH

   Jirka

From: Patrick Spencer
Sent: neděle, 22. listopadu 2015 5:45
To: Django users
Reply To: django-users@googlegroups.com
Subject: List of available Jinja2 global symbols

I'm using Django 1.8.6 with the built in JInja2 support. I spent a while trying to figure out how to pass a csrf token to a JInja2 template. After a while I realized one could just write {{ csrf_token }} in the template, without passing this value through a view, and it would just print out the token. I also realized you could reference a request object without passing it through the view i.e. {{ request.user }} returns the current user. Is there a place in the documentation with all the available global symbols one can use in a Jinja2 template?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/537bd366-180e-4876-8b91-5791f8e22d44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


No comments:

Post a Comment