In python, the code defined in the block of the class is executed, and only then , depending on various things - for example, what was defined in this block - a class is created. Therefore, if you want to associate one class with another, you must write:
class X(models.Model): a = models.ForeignKey(Voter) b = models.CharField(max_length=200)
And this behavior is not related to django.
liori source share