diff options
author | maheshgudi | 2017-02-03 23:42:30 +0530 |
---|---|---|
committer | maheshgudi | 2017-03-02 20:38:41 +0530 |
commit | 321343d45bc1f4d20cd348773bd8b214d9c4d692 (patch) | |
tree | bae4022c3090cc78f4d421f4aa5afa40fd7beebd /yaksh/views.py | |
parent | ddf3e13669f7232acf6019a0f2f33f397a6e6d51 (diff) | |
download | online_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.py | 6 |
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')) |