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)

Meanwhile, it does do query.. As these lines show correct DB output :

<!--loop-->
    {% for item in items %}

    <p class="punar">
        <b>{{item.nominal}}</b> :
        <a href="/punar/items/category/4">
            {{ item.category.name }}
        </a> -
        {{item.info}}
        {% if item.location.location %}
        @{{ item.location.location }}
        {% endif %}
        <span class="waktu">[3:53]</span>

        <a href="/punar/items/delete/85">[x]</a>
    </p>


     {% endfor %}
<!--/loop-->

regards,
Okto.silaban.net

--~--~---------~--~----~------------~-------~--~----~
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