1

Resolved

Changing interpreter for Django project doesn't update Django template analysis

description

The current interpreter is hooked so that we can analyze through the Django libraries and use them for template analysis. But changing the interpreter doesn't kick this process off again, and therefore Django template completions will appear to be broken. closing and re-opening the solution afterwards fixes the problem.

comments

huguesv wrote Sep 24, 2013 at 11:45 PM

I've been using the following code:
from django.template.loader import render_to_string
from django.http.response import HttpResponse

def home(request):
    html = render_to_string('index.html', 
                            {'content':'hello', 
                             'tasks':['task1', 'task2'],
                             'name':'myname',
                            })

    return HttpResponse(html)
and typing {{ in index.html

I need to reload the solution whenever I change interpreters, otherwise I don't get correct completions in the template (I don't get content, tasks, name).

My project consists of 2 Python environments: Python 3.3 with Django installed, and a virtual env based on 3.3, without Django.