2👍
You can use to_field , email
must be unique=True
:
class Commentor(models.Model):
email = models.CharField(max_length=100, blank=False, null=False, primary_key=True, unique=True)
...
class Comments(models.Model):
...
commentor = models.ForeignKey(Commentor, to_field='email')
Source:stackexchange.com