title: How to Link Models in Django? ForiegnKey vs Parent Linking
body: <p>I want to link <code>stdClass</code> and <code>stdDetails</code> with <code>schoolDetails</code> in such a way that I can access <code>stdClass</code> and <code>stdDetails</code> via <code>schoolDetails</code> without rendering the whole models in the WebPage. Is foreign key best to do it?</p>
  <pre><code>from django.db import models
  from django.utils import timezone
  from django.contrib.auth.models import User
  
  # Create your models here.
  class schoolDetails(models.Model):
      sname = models.CharField(max_length=50)
      email = models.CharField(max_length=95)
      subdate = models.DateTimeField(default=timezone.now)
      username = models.CharField(max_length=100)
      principal = models.CharField(max_length=150, default='')
      address = models.CharField(max_length=100, default='Nepal')
      estdate = models.DateField(default=timezone.now)
      numstd = models.IntegerField(default=0)
      url = models.URLField(max_length=200, default='')
      password = models.CharField(max_length=95)
  
      def __str__(self):
          return self.sname
  
  
  class stdClass(models.Model):
      username = models.CharField(max_length=100)
      password = models.CharField(max_length=95)
      ssname = models.CharField(max_length=95)
      cList = models.CharField(max_length=95)
      def __str__(self):
              return self.cList
  class stdDetails(models.Model):
      ondelete = models.ForeignKey(schoolDetails, on_delete=models.CASCADE)
      username = models.CharField(max_length=100)
      password = models.CharField(max_length=95)
      stname = models.CharField(max_length=150, null=True)
      ssname = models.CharField(max_length=150, null=True)
      stadd = models.CharField(max_length=150, null=False)
      stcls = models.CharField(max_length=150, null=True)
      stfname = models.CharField(max_length=150, null=True)
      stmname = models.CharField(max_length=150, null=True)
      stfo = models.CharField(max_length=150, null=True)
      stadate = models.DateField(default=timezone.now)
      stpnum = models.CharField(max_length=95, null=True)
      stbdate = models.DateField(default=timezone.now)
      stpht = models.ImageField(max_length=500, upload_to='')
      #(&quot;&quot;), upload_to=None, height_field=None, width_field=None,
      def __str__(self):
          return self.stname
  #datetime.datetime(2020, 6, 25, 2, 33, 57, 858649, tzinfo=&lt;UTC&gt;)
  </code></pre>