Attendece program, saving all entries at the same time

How can i save the form and add the course name and student name in the views.

models.py
class Attendence (models.Model):
    date = models.DateField(default=datetime.now, blank=True)
    course = models.ForeignKey(Class, null=True,  on_delete=models.CASCADE)
    student = models.ForeignKey(Class_member, null=True,  on_delete=models.CASCADE)
    attendence = models.BooleanField(default=False)

class Course_member (models.Model):
    student = models.ForeignKey(Student, null=True,  on_delete=models.SET_NULL)
    course = models.ForeignKey(Course, null=True,  on_delete=models.CASCADE)
	
class Course (models.Model):
    name = models.CharField(max_length=200)
    teacher = models.ForeignKey(Techer, null=True,  on_delete=models.SET_NULL)
	
views.py
   
def attendence (request, cource_id):
    course = Course.objects.get(id=course_id)
    students = Course_member.objects.filter(course=course)
    attendence_list = Attendence.objects.filter(course=course)
    
    form = attendence_form()

    if request.method == 'POST':
        if form.is_valid():
            form.save()
            return redirect ('db_app:courses')
    
    context = {'attendence':attendence_list, 'form':form, 'students':students, 'course':course}
    return render(request, 'db_app/attendence_course.html', context)
form.py
class Attendence_form(forms.ModelForm):
    class Meta:
        model = Attendence
        fields = ['date','student','course','attendence']
        labels = {'attendence':'',}
template.html

<form action="{% url 'db_app:attendence' course.id %}" method="POST">
  <table class="table">
    <thead>
      <tr>
          <th >Name</th>
          <th >{{form.date}}</th>
        </tr>
    </thead>
    <tbody>
      {% for student in students %}
        <tr>
          <td> {{ student }} </td>
          <td> {{ form.attendence | as_crispy_field }} </td>
        </tr>
      {% endfor %}
    </tbody>
  </table>
  
  <button class="btn btn-primary" name="submit">Save</button>
</form>

You can create your views to contain multiple forms - the mechanics are going to depend upon
whether or not you want one button to submit everything.

If you’ve got multiple students to display in the same form, you can use formsets to create a set of repeated forms for the same model.

You can validate those forms and save them all in the “POST” section of the view.