I am trying to make pydev autocomplete my variables from model data, but for now I have been unable to do it.
I have configured the PYTHONPATH in
Window->Preferences->PyDev->Interpreter - Python
to include both the django folder and my project folder.
Then if I have a model like this:
class Team(models.Model):
name = models.CharField(max_length=50)
id = models.IntegerField()
and from another file of the same django project I import this file
from MyProject.MyApp.models import Team
Code completion works if I do for instance (I use CTRL+SPACE to show me the autocompletion optiosn)
team = Team.objects.[CTRL+SPACE]
But then it does not work if I want to 'autocomplete' the variables of t. For instance
team.[CTRL+SPACE]
does not give me any options. Any idea on how to solve the problem? Thanks
UPDATE: I have been digging more about the origin of the problem and it is not related with the path configuration or the autocompletion configurations, seems that it has to do with detecting the type of an object (the system is not capable of detecting that team is a Team object, and therefore it does not show the object properties).