PyCharm在2016.1.2中不再自动完成Django模型查询 [英] PyCharm doesn't autocomplete Django model queries anymore in 2016.1.2

查看:52
本文介绍了PyCharm在2016.1.2中不再自动完成Django模型查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

2016.1.2版本的PyCharm似乎不再能够自动完成对Django模型的查询。例如,在 Foo.objects.filter(some-field-lookup)上,filter方法不会自动完成(或其他任何方法),而field-lookup参数不会不会完全完成,它们都在PyCharm版本5中起作用。
还有其他人遇到这个问题吗?这是预期的行为吗?是否需要开启某些设置?

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

推荐答案

旧问题,但是由于行为相同,我一直在搜索相同的问题。

Old question, but I was googling the same issue since I had the same behavior.

对我来说,问题原来是PyCharm不知道该站点使用的是Django,因为我没有使用PyCharm的创建工具来启动Django项目。 (我认为大多数人不会尝试他们尝试的前几个项目,这就是自动完成似乎起作用然后中断的原因)。

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)

转到设置/语言和设置下Frameworks / Django,并确保已启用Django支持,并且已正确指定settings.py和manage.py文件。这为我解决了这个问题。

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.

这篇关于PyCharm在2016.1.2中不再自动完成Django模型查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆