From 9c1c80277252fb6b151183bbf4995c96f25e31ff Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Mon, 18 Dec 2017 19:53:59 +0530 Subject: Fix assignment upload to work with new code server --- yaksh/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'yaksh/views.py') diff --git a/yaksh/views.py b/yaksh/views.py index 74d352b..333b77f 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -579,6 +579,7 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None): request, current_question, paper, notification=msg ) for fname in assignment_filename: + fname._name = fname._name.replace(" ","_") assignment_files = AssignmentUpload.objects.filter( assignmentQuestion=current_question, assignmentFile__icontains=fname, user=user, @@ -588,7 +589,8 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None): assignmentQuestion=current_question, assignmentFile__icontains=fname, user=user, question_paper=questionpaper_id) - os.remove(assign_file.assignmentFile.path) + if os.path.exists(assign_file.assignmentFile.path): + os.remove(assign_file.assignmentFile.path) assign_file.delete() AssignmentUpload.objects.create( user=user, assignmentQuestion=current_question, -- cgit