diff options
author | prathamesh | 2016-12-19 13:23:20 +0530 |
---|---|---|
committer | prathamesh | 2016-12-19 13:23:20 +0530 |
commit | d81919b6c8418da9bed0a78f5a7d5344f0ccbc16 (patch) | |
tree | 04ddfb3bc076b921eaa3c486f1cc56bb68010a1a /yaksh | |
parent | ae6e686f2fe3c1f810b57513c590f6a49b7a83e1 (diff) | |
download | online_test-d81919b6c8418da9bed0a78f5a7d5344f0ccbc16.tar.gz online_test-d81919b6c8418da9bed0a78f5a7d5344f0ccbc16.tar.bz2 online_test-d81919b6c8418da9bed0a78f5a7d5344f0ccbc16.zip |
modified to check form validation
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/views.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 98ec0fe..0d77426 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -165,17 +165,17 @@ def add_question(request, question_id=None): files = FileUpload.objects.filter(id__in=hide_files_id) for file in files: file.toggle_hide_status() + formsets = [] + for testcase in TestCase.__subclasses__(): + formset = inlineformset_factory(Question, testcase, extra=0, + fields='__all__') + formsets.append(formset(request.POST, request.FILES, instance=question)) + files = request.FILES.getlist('file_field') + uploaded_files = FileUpload.objects.filter(question_id=question.id) if qform.is_valid(): question = qform.save(commit=False) question.user = user question.save() - files = request.FILES.getlist('file_field') - uploaded_files = FileUpload.objects.filter(question_id=question.id) - formsets = [] - for testcase in TestCase.__subclasses__(): - formset = inlineformset_factory(Question, testcase, extra=0, - fields='__all__') - formsets.append(formset(request.POST, request.FILES, instance=question)) for formset in formsets: if formset.is_valid(): formset.save() |