'PyCharm doesn't autocomplete Django model queries anymore in 2016.1.2

The 2016.1.2 version of PyCharm doesn't seem to autocomplete queries on Django models anymore. For example on Foo.objects.filter(some-field-lookup) the filter method doesn't get autocompleted (or any other method) and also the field-lookup parameters don't get autcompleted, which both worked in PyCharm version 5. Is anybody else having this issue? Is this expected behavior? Is there some setting which needs to be turned on?

Restarting or invalidating the cache and restarting didn't have any effect on this



Solution 1:[1]

For me, the problem turned about to be that PyCharm wasn't aware that the site was using Django, since I didn't use PyCharm's creation tool to start the Django project. (I assume most people don't after the first few projects they try, which is why the autocompletion seems to work and then break)

Go under Settings/Languages & Frameworks/Django, and make sure that Django Support is turned on, and that the settings.py and manage.py files are correctly specified. This fixed the problem for me.

Solution 2:[2]

I've just tried it on 2016.1.2 and the auto-complete works for me for statements which handle models. I have not changed my code editing settings on PyCharm for several versions now.

Baffling. Have you perhaps tried a restart of PyCharm?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 desertnaut
Solution 2 GrahamJ