title: Django creating record into a model with multiple foreign key fields
body: <p>So i basically have a model called Designations that derives foreign keys from 3 other models (curricula, role and staff) and i am trying to save a new record into the Designations model, the code below shows the Designations and Staffs model.</p>
  
  <pre><code>class Designations(models.Model):
      designation_id = models.AutoField(primary_key=True)
      curriculum = models.ForeignKey(Curricula, on_delete=models.CASCADE)
      role = models.ForeignKey(Roles, on_delete=models.CASCADE)
      staff = models.ForeignKey(Staffs, on_delete=models.CASCADE)
  
      class Meta:
          db_table = "arc_designations"
          unique_together = ('curriculum', 'role', 'staff')
          verbose_name_plural = "Designations"
          ordering = ['designation_id']
  
      def __str__(self):
          return '%s of %s %s (%s)' % (self.role.role_name,
                                       self.curriculum.course_period.course.course_abbreviation,
                                       self.curriculum.module_period.module.module_abbreviation,
                                       self.staff.staff_full_name)
  
  class Staffs(models.Model):
      staff_id = models.AutoField(primary_key=True)
      admission_number = models.CharField(max_length=5,
                                          unique=True,
                                          help_text="Enter 5 digits",
                                          validators=[numeric_only, MinLengthValidator(5)])
      staff_full_name = models.CharField(max_length=70,
                                         help_text="Enter staff's full name",
                                         validators=[letters_only])
      created_by = UserForeignKey(auto_user_add=True,
                                  editable=False,
                                  related_name="staff_created_by",
                                  db_column="created_by")
      created_at = models.DateTimeField(auto_now_add=True,
                                        editable=False)
      updated_by = UserForeignKey(auto_user=True,
                                  editable=False,
                                  related_name="staff_updated_by",
                                  db_column="updated_by")
      updated_at = models.DateTimeField(auto_now=True,
                                        editable=False)
      roles = models.ManyToManyField(Roles, through='Designations')
  
      class Meta:
          db_table = "arc_staffs"
          verbose_name_plural = "Staffs"
          ordering = ['staff_id']
  
      def __str__(self):
          return '%s (S%s)' % (self.staff_full_name, self.admission_number)
  </code></pre>
  
  <p>I have made a forms.py to get the admission_number(field in Staffs model)</p>
  
  <pre><code>class AssignRolesForm(forms.Form):
      admission_no = forms.CharField(max_length=40,
                                   widget=forms.TextInput(
                                       attrs={'class': 'form-control', 'aria-describedby': 'add-btn'}))
  </code></pre>
  
  <p>heres my html:</p>
  
  <pre><code>&lt;form action="{% url 'setInstructor' %}" method="POST" role="form"&gt;
                         {% csrf_token %}
                          &lt;div class="form-group"&gt;
                              &lt;div class="input-group"&gt;
                                  {{ form.instructor }}
                                &lt;span class="input-group-btn"&gt;
                                    &lt;button type="submit" class="btn btn-default" id="add-btn"&gt;assign&lt;/button&gt;
                                &lt;/span&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/form&gt;
  </code></pre>
  
  <p>Assuming that when i submit the form i would like for the admission_number entered in the form to reference into the Staffs model then get its PK to be saved into the staff field and for the curriculum and role fields to reference PK 1 of their respective models. How would i write my function in views.py to save a record into Designations model when 'submit' is clicked</p>
  
  <p>heres the views.py that i tried but did not work</p>
  
  <pre><code>@require_POST
  def setInstructor(request):
      form = AssignRolesForm(request.POST)
  
      if form.is_valid():
          staff = Staffs(admission_number=form.cleaned_data['instructor'])
          role = Roles(pk=1)
          curriculum = Curricula(pk=1)
          designation = Designations(staff=staff, role=role, curriculum=curriculum)
          designation.save()
  
      return redirect('index')
  </code></pre>