Hi there. I've been doing Django for awhile but I am stumped on this one.. I have a many to many relationship with a 'through' definition
main.models: class Client(models.Model): uid = models.CharField(max_length=128, unique=True) key = models.CharField(max_length=128) img = models.TextField() version = models.CharField(max_length=20) lastConnection = models.DateTimeField() role = models.CharField(max_length=128,default="") tracker.models: from main.models import Client class PassengerAccess(models.Model): passenger = models.ForeignKey('Passenger',on_delete=models.CASCADE) client = models.ForeignKey(Client,on_delete=models.CASCADE) created = models.DateTimeField(auto_now_add=True,blank=True) selected = models.BooleanField(default=False) class Passenger(models.Model): first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) access_code = models.CharField(max_length=32) school_division = models.ForeignKey(SchoolDivision) open_clients = models.ManyToManyField(Client, through='PassengerAccess') The error I get when I try to migrate is: django.db.utils.ProgrammingError: there is no unique constraint matching given keys for referenced table "tracker_passenger" Any solution to this error appears to be related to a foreign key that is referencing a field that is not unique, but in this case passenger and client should both be accessing the primary key should they not? I always use plain integer primary keys. Any suggestions on how to troubleshoot this would be appreciated. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/db29f623-eecd-4b58-8b70-d2fcd063aaaf%40googlegroups.com.