class test_category(models.Model): id = models.IntegerField(max_length=11) channel_id = models.IntegerField(max_length=11) category = models.CharField(max_length=100) class test_01(models.Model): id = models.IntegerField(max_length=11) channel = models.ForeignKey(test_category, to_field='channel_id') program_id = models.IntegerField(max_length=11) title = models.CharField(max_length=100)
Происходит связь по полю test_category.id, а как сделать по test_category.channel_id? В БД test_category.channel_id проиндексирован.