Code completion in Django templates is not working for me

I'm going through the pycharm django tutorial, and I'm finding that the code completion feature is not working when I edit the templates. The polling web app works fine, so the code in the templates is functional. I can navigate from the view methods to the templates, so pycharm still knows that they are connected. Any suggestions on what I may be missing to get the code completion working?

Also, I'm not clear on how pycharm knows about variables that are being passed from the view to the template. The pycharm tutorial doesn't actually tell you the code that is needed in the view - I borrowed that from the official django tutorial.  So an example of one of my view methods is:

def index(request):
    latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
    return render_to_response('index.html', {'latest_poll_list': latest_poll_list})

And then when I try to use code completion in index.html, it doesn't seem to know anything about latest_poll_list (i.e. ctrl/space doesn't list it, and if I type latest_poll_list followed by a ".", nothing happens).  As I mentioned before, I can navigate from the index method in views.py to index.html, so pycharm has made that connection at least.  How do I get pycharm to see the variables that the view is passing to the template?
1 comment
Comment actions Permalink
Just opened the project again, and now code completion is working. Before I closed it yesterday, I realized that the app was missing from the INSTALLED_APPS list and added it.  Maybe that change got things working for me as far as the code completion.
0

Please sign in to leave a comment.