title: How to create a primary key consists of two fields in Django?
body: <p>I develop a certain application, which I found with the specified database and model schema. I am using Django version 1.8.2. Below is presented a problem. Unnecessary fields have been omitted, model names are invented for the purposes of an example, because I can not disclose. Consider the following models A and B.</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>After a long time a project the possibility that there may be several of the same name A, but with different foreign key B. In this particular case, I would like to model the primary key "A" consisted of two fields: name and related name. How to create such a key consists of two fields in django?</p>