1
Vote

Can't evaluate django template variables passed in a RequestContext

description

Put breakpoint in a django template
<h2>{{ title }}.</h2>
<h3>{{ message }}</h3>

<p>Use this area to provide additional information.</p>
And make sure that the view code is passing in a title and message.

The debugger won't be able to display the value for title or message, using tooltip or watch window.

comments

huguesv wrote Mar 10 at 10:29 PM

I think it's because I'm using RequestContext like this:
def home(request):
    assert isinstance(request, HttpRequest)
    return render(
        request,
        'djangoapp/index.html',
        RequestContext(request,
        {
            'title':'Home Page',
            'year':datetime.now().year,
        })
    )
so it's probably not a regression, I'm not aware of this being tested before.

huguesv wrote May 28 at 11:42 PM

I think you may have closed this one by error, this is a debugging issue, and I can still repro it.

huguesv wrote May 28 at 11:43 PM

Easiest way to repro is to use the new django project template, and put a breakpoint in the layout.html template.