Export to GitHub

minidetector - issue #12

Template syntax not working


Posted on Dec 12, 2010 by Quick Elephant

I'm trying to use the request.mobile variable inside of a template. I've included the (minidetector) project in the django path and can, from inside of view code, print the request.mobile variable (True in the case of a mobile device). However, when I include the following template syntax in a template it prints nothing.

<h1>request.mobile: -->{{ request.mobile }}<--</h1>

Do I need to include a something special in TEMPLATE_CONTEXT_PROCESSORS inside of my settings.py? I can see that it is available in my view (as noted), but is unavailable in my template. Any ideas?

Comment #1

Posted on Dec 28, 2010 by Grumpy Kangaroo

my first guess will be to add django.core.context_processors.request to your context processors setting. For more information see http://docs.djangoproject.com/en/1.2/ref/templates/api/#django-core-context-processors-request. Let me know if this works...

Comment #2

Posted on Dec 29, 2010 by Happy Hippo

Adding the context processors worked for me!

Comment #3

Posted on Dec 30, 2010 by Grumpy Kangaroo

Good

Status: Fixed

Labels:
Type-Defect Priority-Medium