Q:

Django dynamic form for call of roll

I need to create a form with django to check if students are prensent or not. I can't use the 'normal' way to create a form because django want a form model implemented with every fields composing the form. I can't do this cause i don't know the number of students in a class. how can i create a dynamic form who don't care about the number of students ?
at the moemnt i created a form in the template with a for to showthe list of students with each checkbox
            <form method="post">
              {% csrf_token %}
              Date : <input id="date" type="date" class="mt-3 mb-3">
              <br>
              {% for student in student_list %}
                <input type="checkbox" id="student{{forloop.counter}}" name="student{{forloop.counter}}">
                <label for="student{{forloop.counter}}">{{student.first_name }} {{student.last_name}}</label>
                <br>
              {% endfor %}
              <button class="btn btn-outline-primary mr-4"><a href="/lycee/">Cancel</a></button>
              <button type="submit" class="btn btn-success radius d-flex">Submit</button>
            </form>

A:

EDIT :
I just named each checkbox 'student' then i get each checkbox data in view.py
call_of_roll.html
        <form method="post">
          {% csrf_token %}
          Date : <input name="date" type="date" class="mt-3 mb-3" value="{{defaultdate|date:"Y-m-d" }}" required>
          <br>
          {% for student in student_list %}
            <input type="checkbox" id="{{student.id}}" name="student{{student.id}}" checked>
            <label for="student{{student.id}}">{{student.first_name }} {{student.last_name}}</label>
            <br>
          {% endfor %}
          <p>Check if the student is present</p>
          <div class="row">
            <button class="btn btn-outline-primary mr-4"><a href="/lycee/">Cancel</a></button>
            <button type="submit" class="btn btn-success radius d-flex">Submit</button>
          </div>
        </form>

views.py
if request.method == 'POST':
    date = request.POST.get("date")
    for student in students:
      missing = request.POST.get('student'+str(student.id), "off")

