From a template suppose base.html in your templates how do I access
the request object without actually passing it via the view. Cause I
can access the user object using {{ user }} but I can't access the
get_full_path using something like {{ request.get_full_path }}
Any thoughts?
Sounds like you are using a RequestContext, which is the first step. That plus having the auth context processor listed in the TEMPLATE_CONTEXT_PROCESSORS setting would give you a template variable user. (The auth context processor is included in the default setting value for TEMPLATE_CONTEXT_PROCESSORS.)
The context processor that would set request is this one: http://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-context-processors-request. That one is not in the default TEMPLATE_CONTEXT_PROCESSORS setting, so if you want request to be set in all your templates then you'll need to add it.
Karen
--
http://tracey.org/kmt/
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment