title: Django - get id of posted form in post method of view that contains list of forms
body: <p>I have a view that display a list of Lecture object each lecture has a file select button that automatically submits the selected file.</p>
  
  <p>The relevant part in html template:</p>
  
  <pre><code>{% for lecture in past_lectures %}
      &lt;form method = "post" id=upload_{{lecture.pk}} action=""&gt;
          {% csrf_token %}
          &lt;input type="file" onchange="$('#upload_{{lecture.pk}}').submit();" value="Upload Audio..."/&gt;
      &lt;/form&gt;
  {% endfor %}
  </code></pre>
  
  <p>The view class:</p>
  
  <pre><code>class LectureListView(ListView):
      model = Lecture
      ordering = ('name', )
      context_object_name = 'past_lectures'
      template_name = 'professor/home.html'
  
      def get_queryset(self):
          professor = self.request.user.professor
          lecture_queryset = Lecture.objects.filter(course__professor = professor)
  
          return lecture_queryset
  
      def post(self, request,):
          pk = int(request.POST['id'].split('_').[-1]) #return the pk portion of the id of the form
          lecture = Lecture.objects.get(pk=pk)
          lecture.audio = request.FILES['audio'] #audio is the name of the filefield in Lecture model
          lecture.save()
          return reverse('professor:home')
  </code></pre>
  
  <p>The problem is that request.POST['id'] does not return the id of the form but rather looks for any element with the name 'id' which doesn't exist.</p>
  
  <p>How do I get the lecture.pk value based on the form submitted?</p>