I have a model that auto created an auto inc id field as primary key. It related smoothly with my person model, but when I try to create a relation to committees (Komiteer) I get a new intermediate table with (an auto inc primary key, that's ok, a working relation to commitees, smooth and
a non working wrong data type field that I'd expect to link to persons)
Heres the model with the ManyToManyField:
class Dagensrepresentanter(models.Model):
person = models.ForeignKey(Personer, related_name='dagensrepresentanter_person')
vara_for = models.ForeignKey(Personer, blank=True, null=True, related_name='dagensrepresentanter_vara_for')
komiteer = models.ManyToManyField(Komiteer)
it generats this intermediate table (I only included the fields for simplicity):
`id` int(11) NOT NULL AUTO_INCREMENT,
`dagensrepresentanter_id` int(11) NOT NULL,
`komiteer_id` varchar(150) NOT NULL,
The line in italics is a int(11), and probably links fine with the auto generated id in the model for Dagensrepresentanter but it need to link to the person field. In the person table the datatype for this value is varchar(33) NOT NULL
How do I specify that the foreign key in the intermediate table is the person field from the Dagensrepresentanter model?