this is my code in html
<tr>
<td colspan="2" style="text-align: center;"><h2 style="font-weight: bold;">Required Documents:</h2></td>
</tr>{% for d in doc %}
<tr>
<td style="text-align: left;">
<input type="file" name="myfile-{{d.id}}" value="{{d.id}}" style="outline: none;" required/>{{d.id}}{{d.Description}}</td>
<td></td>
</tr>
{% endfor %}
what I tried in my views.py
myfile = request.FILES['myfile-6']
fs = FileSystemStorage()
filename = fs.save(myfile.name, myfile)
uploaded_file_url = fs.url(filename)
insert_doc = StudentsSubmittedDocument(
Students_Enrollment_Records = V_insert_data,
Document = myfile
)
insert_doc.save()
I don’t have idea on how to loop this myfile = request.FILES[‘myfile-6’]
with the existing id of Table Documents. please help me guys, im stuck on this problem 3days