summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authoraditya2020-05-22 20:54:42 +0530
committeraditya2020-05-22 20:54:42 +0530
commitd7c3a232e843cce5dcf6d1e80c3498f24e7dfda2 (patch)
tree21a258614f294fa2ef2bef16ce329b95eb99bced /yaksh/views.py
parentfa656e1ce81c748b354e19e6d5b8de672a58c186 (diff)
downloadonline_test-d7c3a232e843cce5dcf6d1e80c3498f24e7dfda2.tar.gz
online_test-d7c3a232e843cce5dcf6d1e80c3498f24e7dfda2.tar.bz2
online_test-d7c3a232e843cce5dcf6d1e80c3498f24e7dfda2.zip
Change question template
- Update tinymce editor with additional plugins - Fix issue in question file upload for empty question instance - Change variable name for uploaded file to avoid conflict with queryset variable - Remove description preview
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index e4a9038..ca827ac 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -237,12 +237,9 @@ def add_question(request, question_id=None):
qform = QuestionForm(request.POST, instance=question)
fileform = FileForm(request.POST, request.FILES)
remove_files_id = request.POST.getlist('clear')
- files = request.FILES.getlist('file_field')
+ added_files = request.FILES.getlist('file_field')
extract_files_id = request.POST.getlist('extract')
hide_files_id = request.POST.getlist('hide')
- if files:
- for file in files:
- FileUpload.objects.get_or_create(question=question, file=file)
if remove_files_id:
files = FileUpload.objects.filter(id__in=remove_files_id)
for file in files:
@@ -267,12 +264,16 @@ def add_question(request, question_id=None):
request.POST, request.FILES, instance=question
)
)
- files = request.FILES.getlist('file_field')
if qform.is_valid():
question = qform.save(commit=False)
question.user = user
question.save()
# many-to-many field save function used to save the tags
+ if added_files:
+ for file in added_files:
+ FileUpload.objects.get_or_create(
+ question=question, file=file
+ )
qform.save_m2m()
for formset in formsets:
if formset.is_valid():