Since Python is not a strongly typed programming language, you do not have to specify your variable type. This is nice but have some drawback for Netbeans, which it can not recognize the type easily so you can not have good suggestion for the intellisense feature. To fix that you have to specify the type of your variable and make sure you already import the correct module.
For example, when you have this kind of code (below code are for example purpose only)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
| from datetime import datetime
from django.db import models
from django.utils.translation import gettext_lazy as _
class Poll(models.Model):
question = models.CharField(max_length=200)
password = models.CharField(max_length=200)
pub_date = models.DateTimeField(_('date published'),
default=datetime.now)
class Admin:
pass
def __str__(self):
return self.question
def get_choice_list(self):
return list(self.choice_set.order_by('id'))
def get_choice_from_num(self, choice_num):
try:
return self.get_choice_list()[int(choice_num)-1]
except IndexError:
raise Choice.DoesNotExist
class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
class Admin:
pass
def __str__(self):
return self.choice
def get_num(self):
try:
return self.poll.get_choice_list().index(self)+1
except ValueError:
raise Choice.DoesNotExist |
For people like me, usually the first thing I do when want to use a defined variable is to hit the ctrl-space button to display the Intellisense suggestion. But in this case, when I want to use functions or variables defined in the attribute poll in Choice class, it displays :

Which means Netbeans does’nt understand the type and the intellisense just throw all the types available to you and it become garbage, instead of suggestion. To teach Netbeans the type of the variable, just click the Specify type of [the variable name] menu, and then type your variable’s type. After that the intellisense will give you nice result, like this picture below:

Other thing is to make sure you have imported your class in your file so Netbeans will recognized it properly. Hope it helps, Cheers!