[Fixed]-Django: File Upload – Attach a file to a specific job id in task manager app

1👍

Your view for ‘upload’ is not sending any context variable named ‘item’, so when you try to open the page, item.id is empty and it fails because of this.

<form action="{% url 'upload' item.id %}" method="post" enctype="multipart/form-data">

Note that the argument in the reversematch error is empty. Also I would recommend going through the docs for File Uploading. I’m not sure whether DocumentForm is a ModelForm but you’ll need that or a file upload handler to properly upload your file. They have a decent enough example there.

👤onyeka

Leave a comment