title: Save data into two table. Student with ID “None” doesn’t exist. Perhaps it was deleted?
body: <p>I tried to save data to the standard User class and for my Student class. But I've got a problem.</p>
  
  <p><strong>Student with ID “None” doesn’t exist. Perhaps it was deleted?</strong>
  I don't really know how to save these data.</p>
  
  <p>models.py</p>
  
  <pre><code>class Student(models.Model):
      studentIndex = models.IntegerField(unique=True)
      studentName = models.CharField(max_length=50)
      studentSurname = models.CharField(max_length=50, default='')
      studentPhoneNumber = models.CharField(max_length=12, default='+48')
      studentPesel = models.CharField(max_length=11, default='')
      studentStudyMode = models.CharField(max_length=12, default='')
      studentFaculty = models.CharField(max_length=30, default='')
      studentSemester = models.IntegerField(default='')
      studentAddress = models.CharField(max_length=255, default='')
      studentMotherName = models.CharField(max_length=100, default='')
      studentBirth = models.DateField(help_text='year-month-day')
      studentEmail = models.EmailField(max_length=255, default='')
      studentImage = models.ImageField(default='default.jpg', upload_to='profile_pics')
      studentPassword = models.CharField(max_length=100, default='12345678',
                                         help_text='Do not modify this field. Password will be generated automatically')
      studentDateJoined = models.DateTimeField(default=now)
  
      def save(self, *args, **kwargs):
          default_password = str(self.studentBirth)[0:4] + str(self.studentBirth)[5:7] + \
                             str(self.studentBirth)[8:10] +\
                             self.studentMotherName[0] +\
                             lower(self.studentName[0])
          User.objects.create_user(username=self.studentIndex, email=self.studentEmail, password=default_password,
                                   first_name=self.studentName, last_name=self.studentSurname)
  
      def __str__(self):
          return f'{self.studentIndex} - {self.studentName} {self.studentSurname}'
  </code></pre>
  
  <p>When I try this </p>
  
  <pre><code>...
      def save(self, *args, **kwargs):
          default_password = str(self.studentBirth)[0:4] + str(self.studentBirth)[5:7] + \
                             str(self.studentBirth)[8:10] +\
                             self.studentMotherName[0] +\
                             lower(self.studentName[0])
          Student.objects.create() # &lt;- this one
          User.objects.create_user(username=self.studentIndex, email=self.studentEmail, password=default_password,
                                   first_name=self.studentName, last_name=self.studentSurname)
  </code></pre>
  
  <p>I've got <strong>string index out of range</strong> error (IndexError) or maximum recursion depth exceeded in comparison (RecursionError)</p>
  
  <p>I'm new in Django, so I'll be grateful if you'll help me
  Thanks a lot</p>