Skip to content

SQL panel points a query in an included template to the same line of its parent template #902

Closed
@lingxiaoyang

Description

@lingxiaoyang

Tested with:

views.py

from test_debug_toolbar.models import Question

def index(request):
    return render(request, 'index.html', {'questions': Question.objects.all()})

index.html

{% extends 'base.html' %}

{% block content %}

<h5>Hello there! This is a test for debug toolbar.</h5>

<p>Below is an included template that makes a SQL query. But in debug toolbar, it is signified in "index.html", while it should be in "inner.html".</p>

{% include 'inner.html' %}

{% endblock content %}

inner.html

<p>Here's inner.html:</p>


<p>All questions:</p>
{{ questions }}

The SQL query of Question.objects.all() is executed at the line 5 of inner.html, but in the SQL panel, it is incorrectly pointed to the line 5 of its parent template index.html:

image

Tested with current master and develop branch, and Django 1.10.4.

For the complete test Django project: https://github.com/lingxiaoyang/test_debug_toolbar

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions