summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparth2012-04-12 12:18:23 +0530
committerparth2012-04-12 12:18:23 +0530
commit31b6f7917ce1f6e7d8308d57c951ac670f37c250 (patch)
tree9752f8d57c24337afe91f1555357bc3e074a84f8
parent983103c96ffac65f1ad22386f48407fe832f972e (diff)
downloadaloha-31b6f7917ce1f6e7d8308d57c951ac670f37c250.tar.gz
aloha-31b6f7917ce1f6e7d8308d57c951ac670f37c250.tar.bz2
aloha-31b6f7917ce1f6e7d8308d57c951ac670f37c250.zip
Fixed the value error on apply page
-rw-r--r--aloha/allotter/views.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/aloha/allotter/views.py b/aloha/allotter/views.py
index c53abe3..a1091f5 100644
--- a/aloha/allotter/views.py
+++ b/aloha/allotter/views.py
@@ -172,8 +172,13 @@ def submit_options(request):
options_chosen_list = [] #Initializing empty list for storing options
for option in options_available_list:
- option_pref = request.POST[unicode(option.opt_code)]
- options_chosen_list.append([int(option_pref), str(option.opt_code)]) #[preference, option code]
+ option_pref = request.POST[unicode(option.opt_code)]
+ try:
+ options_chosen_list.append([int(option_pref), str(option.opt_code)]) #[preference, option code]
+ except ValueError:
+ context = get_details(user)
+ return render(request, 'allotter/apply.html', context)
+
options_chosen_list.sort() #Sorting by preference