hetaov / minidetector

Automatically exported from code.google.com/p/minidetector
0 stars 0 forks source link

Template syntax not working #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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?

Original issue reported on code.google.com by john.g...@gmail.com on 12 Dec 2010 at 11:57

GoogleCodeExporter commented 8 years ago
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-proc
essors-request. Let me know if this works...

Original comment by remi.barraquand on 28 Dec 2010 at 4:07

GoogleCodeExporter commented 8 years ago
Adding the context processors worked for me!

Original comment by ryanwil...@gmail.com on 29 Dec 2010 at 6:25

GoogleCodeExporter commented 8 years ago
Good

Original comment by remi.barraquand on 30 Dec 2010 at 10:59