Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 988
tschale Avatar asked Apr 19 '16 15:04

tschale


1 Answers

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.

like image 149
CrimsonJD Avatar answered Oct 27 '22 01:10

CrimsonJD