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?
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/j4-k2caVkpYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment