On Sun, 2009-05-03 at 07:47 +0700, Okto Silaban wrote:
> 
> 
> On Sun, May 3, 2009 at 7:04 AM, George Song <geo...@damacy.net> wrote:
> 
>         
>         Django has extensive documentation. It's advisable that you
>         look it up
>         first before asking:
>         
>         
> <http://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-context-processors-debug>
> 
> Default :
> DEBUG = True
> TEMPLATE_DEBUG = DEBUG 
> 
> 
> And I've added this in settings.py :
> 
> TEMPLATE_CONTEXT_PROCESSORS = (
>     "django.core.context_processors.auth",
>     "django.core.context_processors.debug",
>     "django.core.context_processors.i18n"
> )
> 
> INTERNAL_IPS = ('127.0.0.1',)
> 
> And added these lines in my template file  :
> 
> <div id="debug">
>   <h2>Queries</h2>
>   <p>
>     {{ sql_queries|length }} Quer{{ sql_queries|pluralize:"y,ies" }}
>     {% ifnotequal sql_queries|length 0 %}
>     (<span style="cursor: pointer;" onclick="var
> s=document.getElementById('debugQueryTable').style;s.display=s.display=='none'?'':'none';this.innerHTML=this.innerHTML=='Show'?'Hide':'Show';">Show</span>)
>     {% endifnotequal %}
>   </p>
>   <table id="debugQueryTable" style="display: none;">
>     <col width="1"></col>
>     <col></col>
>     <col width="1"></col>
>     <thead>
>     <tr>
>       <th scope="col">#</th>
>       <th scope="col">SQL</th>
>       <th scope="col">Time</th>
>     </tr>
>     </thead>
>     <tbody>
>     {% for query in sql_queries %}<tr class="{% cycle odd,even %}">
>       <td>{{ forloop.counter }}</td>
>       <td>{{ query.sql|escape }}</td>
>       <td>{{ query.time }}</td>
>     </tr>{% endfor %}
>     </tbody>
>   </table>
> </div>
> 
> This is the output : 
> Queries
> 0 Query (Show) 

How are you rendering that template? The only thing I can think of that
will go wrong here is if you do not pass a RequestContext to
render_to_response() -- or whatever rendering method you are using.
Context processors only run if the context is a RequestContext, not
simply a Context object.

See this documentation (esp. the "note" callout):
http://docs.djangoproject.com/en/dev/ref/templates/api/#id1

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to