I am developing a specific application that I found with the specified database and model schema. I am using Django version 1.8.2. Below is the problem. Unnecessary fields are omitted, model names are invented as an example, because I canโt open. Consider the following models A and B.
class B (models.Model): name = models.CharField(max_length=100) class A (models.Model): name = models.CharField(max_length=100, primary_key=True) related_name = models.ForeignKey(B, null=True, blank=True)
After a long project time, it is possible that there may be several names of the same name A, but with a different foreign key B. In this particular case, I would like to model the primary key "A", consisting of two fields: name and surname. How to create such a key consists of two fields in django?
source share