diff options
author | adityacp | 2021-03-01 11:13:07 +0530 |
---|---|---|
committer | adityacp | 2021-03-01 11:13:07 +0530 |
commit | 542433598aad0efffee7619e1f113425147bcec0 (patch) | |
tree | be5cb438c81f76ad8d9e593b9e33033f0183c9ab /yaksh/models.py | |
parent | b2bf7b9fef33d59cd1e55776a51577d66a252322 (diff) | |
download | online_test-542433598aad0efffee7619e1f113425147bcec0.tar.gz online_test-542433598aad0efffee7619e1f113425147bcec0.tar.bz2 online_test-542433598aad0efffee7619e1f113425147bcec0.zip |
Add AWS support for file upload
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 11ddf8a..dd3838a 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -51,6 +51,8 @@ from yaksh.code_server import ( from yaksh.settings import SERVER_POOL_PORT, SERVER_HOST_NAME from .file_utils import extract_files, delete_files from grades.models import GradingSystem +from yaksh.storage_backends import PublicMediaStorage + languages = ( ("python", "Python"), @@ -1442,8 +1444,9 @@ class Question(models.Model): assignmentQuestion=self, user=user ) if assignment_files: - metadata['assign_files'] = [(file.assignmentFile.path, False) + metadata['assign_files'] = [(file.assignmentFile.url, False) for file in assignment_files] + print(metadata['assign_files']) question_data['metadata'] = metadata return json.dumps(question_data) @@ -2661,7 +2664,9 @@ class AssignmentUploadManager(models.Manager): class AssignmentUpload(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) assignmentQuestion = models.ForeignKey(Question, on_delete=models.CASCADE) - assignmentFile = models.FileField(upload_to=get_assignment_dir, max_length=255) + assignmentFile = models.FileField( + upload_to=get_assignment_dir, max_length=255 + ) question_paper = models.ForeignKey(QuestionPaper, blank=True, null=True, on_delete=models.CASCADE) course = models.ForeignKey(Course, null=True, blank=True, |