title: Django: issue with relationships between tables
body: <p>I am creating an enrolment page for a website using Django.  I have three tables: the default User table, a Profile table (to capture additional info) and a Subscription table.</p>
  
  <p><strong>I have setup the Profile table as follows:</strong></p>
  
  <pre><code>class Profile(models.Model): 
      user_id = models.ForeignKey(User, on_delete=models.CASCADE)
      profile_id = models.AutoField(primary_key=True)
  </code></pre>
  
  <p><strong>I have setup the Subscription table as follows:</strong></p>
  
  <pre><code>class Subscription(models.Model):
     subscription_no = models.AutoField(primary_key=True)
     user_id = models.ForeignKey(User, on_delete=models.CASCADE)
     profile_id = models.ForeignKey(Profile, on_delete=models.CASCADE)
  </code></pre>
  
  <p>When a new user enrols, I create a new Profile and Subscription object for that user in views.py:</p>
  
  <pre><code> #Create a new Profile object for the User
   user_profile = Profile()
   lookup_user = User.objects.get(username=username)
   lookup_user_id = lookup_user.pk
   user_profile.user_id = User.objects.get(pk=lookup_user_id)
  
   #Create a new Subscription object for the User
   user_subscription = Subscription()
   user_subscription.user_id = User.objects.get(pk=lookup_user_id) 
  
   lookup_profile = Profile.objects.get(user_id=user_profile.user_id)
   lookup_profile_id = lookup_profile.pk
   user_subscription.profile_id = Profile.objects.get(pk=lookup_profile_id)
  </code></pre>
  
  <p>Everything works okay, except I am worried that I am establishing the relationship between the tables in an incorrect manner. When I add the User, Profile and Subscription tables to the Django Admin app, the following appears for each new user profile:</p>
  
  <p><a href="https://i.stack.imgur.com/5YPNE.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5YPNE.jpg" alt="New Profile for a created user"></a></p>
  
  <p>The following appears for a Subscription object created for a new User:</p>
  
  <p><a href="https://i.stack.imgur.com/BlIjO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BlIjO.jpg" alt="New Subscription created for a user"></a></p>
  
  <p>And finally, if I open up a Subscription object, for example, the relationship field (which should be the primary key) just displays the text "Profile object":</p>
  
  <p><a href="https://i.stack.imgur.com/Jtcni.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jtcni.jpg" alt="Relationship field between User Profile and User Subscription"></a></p>
  
  <p>I thought that the profile_id field would be an auto-increment number that would appear instead of "Profile object". I am new to Django, and I am worried that I am not establishing the relationship between the Tables correctly.</p>
  
  <p>Your advice is much appreciated. Thanks in advance.</p>