-1

I have referred to multiple django question regarding file download and this was the solution suggested.

{% for task in tasks %}
            <tr><td><strong> name {{task.name}}</strong></td>           
            <td><strong> date {{task.date_created}}</strong></td>
            <td><strong> status  {{task.status}}</strong></td>
            <td><strong> id {{task.id}}</strong></td>
            <td><strong> input file {{task.input_file_path}}<td>
            <td><a href="{{task.output_file_path}}" download>output file</td></tr>
            {% endfor %}

The solution suggested is <a href="{{task.output_file_path}}" download> However, when i check my django request. It shows up this in console. GET /adv_filters/check/download/download/download/download/download/download/download/download/download/download/download/download/download/download/download/download/download/download/download/download/input_files/input_files/input_files/input_files/input_files/task4 HTTP/1.1" 200 2524

For testing purposes. I have set the location of the output file to be the location of the input file.

My relevant views.py

document.input_file_path = 'input_files/' + document.name
            document.output_file_path = 'input_files/' + document.name

Models.py

doc = models.FileField(upload_to='input_files')

Is there anymore information i would need.

Samuel Liew
  • 76,741
  • 107
  • 159
  • 260
aceminer
  • 4,089
  • 9
  • 56
  • 104

1 Answers1

1

I guess simply putting file link(i.e. which I am assuming {{task.output_file_path}} is) should work.

<td><a href="{{task.output_file_path}}"</a> Download output file</td>
kartikmaji
  • 946
  • 7
  • 22