summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authormaheshgudi2017-02-03 23:42:30 +0530
committermaheshgudi2017-03-02 20:38:41 +0530
commit321343d45bc1f4d20cd348773bd8b214d9c4d692 (patch)
treebae4022c3090cc78f4d421f4aa5afa40fd7beebd /yaksh/views.py
parentddf3e13669f7232acf6019a0f2f33f397a6e6d51 (diff)
downloadonline_test-321343d45bc1f4d20cd348773bd8b214d9c4d692.tar.gz
online_test-321343d45bc1f4d20cd348773bd8b214d9c4d692.tar.bz2
online_test-321343d45bc1f4d20cd348773bd8b214d9c4d692.zip
added float based questions
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 6a19744..d067393 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -476,6 +476,12 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None):
except ValueError:
msg = ["Please enter an Integer Value"]
return show_question(request, current_question, paper, msg)
+ elif current_question.type == 'float':
+ try:
+ user_answer = float(request.POST.get('answer'))
+ except ValueError:
+ msg = ["Please enter a Decimal Value"]
+ return show_question(request, current_question, paper, msg)
elif current_question.type == 'string':
user_answer = str(request.POST.get('answer'))