Browse Source

support file download

https
jakobsn 6 years ago
parent
commit
61cf2b8f3e
2 changed files with 5 additions and 2 deletions
  1. +3
    -0
      src/app/templates/project.html
  2. +2
    -2
      src/app/views/project.py

+ 3
- 0
src/app/templates/project.html View File

@@ -22,6 +22,9 @@ $def with (nav, project, tasks)
$for task in tasks:
<li id="$task[0]">$task
<br>
$for filename in get_task_files(task[0]):
<a href="$filename[0]" download>$filename[0].split("/")[-1]</a>
<br>
<form method="POST" enctype="multipart/form-data" action="">
<input type="file" name="myfile" />
<br/>


+ 2
- 2
src/app/views/project.py View File

@@ -30,7 +30,7 @@ class Project:
else:
project = [[]]
tasks = [[]]
render = web.template.render('templates/', globals={'get_task_files':models.project.get_task_files})
return render.project(nav, project[0], tasks)

def POST(self):
@@ -59,7 +59,7 @@ class Project:
sleep(0.5)
open(path + '/' + fn, 'wb').write(fileitem.file.read())
message = 'The file "' + fn + '" was uploaded successfully'
models.project.set_task_file(data.taskid, (path + "/" + fn))
else:
message = 'No file was uploaded'


Loading…
Cancel
Save