title: Non-primary foreign keys in Django
body: <p>I have two tables from a legacy database that I want to access from a Django site. They look like this:</p>
  
  <pre><code>Table A
  id (int, primary key)
  name (string, unique)
  ...
  
  Table B
  id (int, primary key)
  name
  record_date
  (name, record_date are unique together)
  ...
  </code></pre>
  
  <p>How do I tell my Django model that Table <code>A</code> has a one-to-many relationship with <code>B</code> on <code>A.name=B.name</code>? The regular <code>ForeignKey</code> relationship would require that <code>B</code> use <code>A.id</code> instead of <code>name</code>, but I can't modify the structure of the existing legacy database.</p>